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_F
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
>
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 supp
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 objec
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,
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:5341
Nick> With an explicit base, however, PyLong_FromString is called
Nick> directly. Since that API takes a char* string, it stops at the
Nick> first embedded NULL:
long('123\0003', 10)
Nick> 123L
long('123\00032', 10)
Nick> 123L
Nick> So 'long_from_string
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
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 "", line 1, in
ValueError