[New-bugs-announce] [issue16773] int() half-accepts UserString
Serhiy Storchaka
report at bugs.python.org
Mon Dec 24 21:15:15 CET 2012
New submission from Serhiy Storchaka:
In Python 3 int() accepts UserString argument without explicit base and reject it with explicit base.
>>> from collections import UserString
>>> int(UserString('100'))
100
>>> int(UserString('100'), 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int() can't convert non-string with explicit base
In 2.7 the same behavior also for MutableString and bytearray.
----------
components: Interpreter Core
messages: 178096
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: int() half-accepts UserString
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16773>
_______________________________________
More information about the New-bugs-announce
mailing list