[New-bugs-announce] [issue9578] int() raises UnicodeDecodeError when called on malformed string

Alexander Belopolsky report at bugs.python.org
Thu Aug 12 19:52:38 CEST 2010


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

>>> int('\xA11')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 0: invalid start byte

This is inconsistent with other number types' behavior: 
>>> float(b'\xA1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: �

----------
messages: 113694
nosy: belopolsky, mark.dickinson
priority: normal
severity: normal
status: open
title: int() raises UnicodeDecodeError when called on malformed string

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


More information about the New-bugs-announce mailing list