Calvin Spealman wrote:
Added a check in test_long.LongTest.test_misc() that long(123\0, 10)
fails properly and adapted the patch to int_new to long_new. I get
this weird feeling that if its impossible for the function
(PyLong_FromString) to know if its being given bad data, having know
way to
On 1/18/07, Nick Coghlan [EMAIL PROTECTED] wrote:
Calvin Spealman wrote:
Added a check in test_long.LongTest.test_misc() that long(123\0, 10)
fails properly and adapted the patch to int_new to long_new. I get
this weird feeling that if its impossible for the function
(PyLong_FromString)
Added a check in test_long.LongTest.test_misc() that long(123\0, 10)
fails properly and adapted the patch to int_new to long_new. I get
this weird feeling that if its impossible for the function
(PyLong_FromString) to know if its being given bad data, having know
way to know if the string is
SVN rev 52305 resolved Bug #1545497: when given an explicit base,
int() did ignore NULs embedded in the string to convert.
However, the same fix wasn't applied for long().
n
On 1/13/07, Guido van Rossum [EMAIL PROTECTED] wrote:
What's wrong with this session? :-)
Python 2.6a0 (trunk:53416,
Is it a more general problem that null-terminated strings are used
with data from strings we specifically allow to contain null bytes?
Perhaps a migration of *FromString() to *FromStringAndSize()
functions, or taking Python string object pointers, would be a more
general solution to set as a goal,
On 1/14/07, Calvin Spealman [EMAIL PROTECTED] wrote:
Is it a more general problem that null-terminated strings are used
with data from strings we specifically allow to contain null bytes?
Perhaps a migration of *FromString() to *FromStringAndSize()
functions, or taking Python string object
What's wrong with this session? :-)
Python 2.6a0 (trunk:53416, Jan 13 2007, 15:24:17)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type help, copyright, credits or license for more information.
int('123\0')
Traceback (most recent call last):
File stdin, line 1, in module
ValueError:
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*