[ python-Bugs-1545497 ] inconsistent treatment of NULs in int()

SourceForge.net noreply at sourceforge.net
Wed Aug 23 21:37:28 CEST 2006


Bugs item #1545497, was opened at 2006-08-23 12:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1545497&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Nobody/Anonymous (nobody)
Summary: inconsistent treatment of NULs in int()

Initial Comment:
In int_new (Objects/intobject.c), embedded NUL chars
are handled differently.

We should check that the entire string is converted
like PyNumber_Int().  int('5\0') raises an exception. 
int('5\0', 10) returns 5.

>>> int('5\0', 10)
5
>>> int('5\0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: null byte in argument for int()

The difference is the explicit vs implicit base.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1545497&group_id=5470


More information about the Python-bugs-list mailing list