[issue7710] Inconsistent Exception for int() conversion

Florent Xicluna report at bugs.python.org
Fri Jan 15 21:26:24 CET 2010


Florent Xicluna <laxyf at yahoo.fr> added the comment:

The null byte gives UnicodeEncodeError for other conversions too.

Python 3:
 int('\0'), float('\0'), complex('\0')

Python 2:
 int(u'\0'), long(u'\0'), float(u'\0'), complex(u'0')


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'decimal' codec can't encode character u'\x00' in position 1: invalid decimal Unicode string

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7710>
_______________________________________


More information about the Python-bugs-list mailing list