[issue21546] int('\0') gives wrong error message
Kurt Rose
report at bugs.python.org
Wed May 21 01:38:26 CEST 2014
New submission from Kurt Rose:
int() ignores everything after a null byte when reporting an error message.
Here you can see an example of how this manifests, and why could be a problem.
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> int('a')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'a'
>>> int('\0a')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: ''
>>> int('abc\0def')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'abc'
----------
components: Interpreter Core
messages: 218859
nosy: Kurt.Rose
priority: normal
severity: normal
status: open
title: int('\0') gives wrong error message
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21546>
_______________________________________
More information about the Python-bugs-list
mailing list