A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-January/070686.html below:

[Python-Dev] buglet in long("123\0", 10)

[Python-Dev] buglet in long("123\0", 10)Nick Coghlan ncoghlan at gmail.com
Thu Jan 18 13:19:55 CET 2007
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 know if the string is supposed to continue past the zero-byte,
> then doesn't it make sense to say that the function by design is
> broken?

It makes sense to say the function is being misused in this case - it's 
designed to convert *C* strings to PyLong objects, so the assumption 
that there are no embedded NULs is a valid one. That said, I think a 
better patch for 2.6 would be to provide a separate PyLong_FromPyString 
function which did the embedded NULL check (and update abstract.c to use 
that instead of its own internal function).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
More information about the Python-Dev mailing list

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