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   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to