This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: inconsistent treatment of NULs in int()
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, nnorwitz
Priority: normal Keywords:

Created on 2006-08-23 19:37 by nnorwitz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg29624 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-08-23 19:37
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.
msg29625 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-10-12 11:28
Logged In: YES 
user_id=849994

Fixed in rev. 52305, 52306 (2.5).
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43882
2006-08-23 19:37:28nnorwitzcreate