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
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