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, so this sort of thing can't crop up down the road, again.
I know I'm still very uninitiated in the internals of CPython, so anyone please correct me if my thoughts here are against any on-going policy or reasoning. On 1/14/07, Neal Norwitz <[EMAIL PROTECTED]> wrote: > 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, 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: null byte in argument for int() > > >>> int('123\0', 10) > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > ValueError: invalid literal for int() with base 10: '123\x00' > > >>> long('123\0') > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > ValueError: null byte in argument for long() > > >>> long('123\0', 10) > > 123L > > >>> > > > > -- > > --Guido van Rossum (home page: http://www.python.org/~guido/) > > _______________________________________________ > > 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/nnorwitz%40gmail.com > > > _______________________________________________ > 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/ironfroggy%40gmail.com > -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://ironfroggy-code.blogspot.com/ _______________________________________________ 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