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 <rep...@bugs.python.org>
<http://bugs.python.org/issue16773>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to