A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2007-January/070631.html below:

[Python-Dev] buglet in long("123\0", 10)

[Python-Dev] buglet in long("123\0", 10)Nick Coghlan ncoghlan at gmail.com
Sun Jan 14 08:06:45 CET 2007
Guido van Rossum wrote:
>>> long('123\0', 10)
> 123L

Interesting - long_new goes through PyNumber_Long if no explicit base is 
provided. That does a pre-check for embedded NULLs in the input string. 
With an explicit base, however, PyLong_FromString is called directly. 
Since that API takes a char* string, it stops at the first embedded NULL:

 >>> long('123\0003', 10)
123L
 >>> long('123\00032', 10)
123L


So 'long_from_string' in abstract.c already has this problem solved - 
the helper function just needs to be moved into longobject.c so it can 
be used for explicit bases as well.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4