[issue6396] '' % object() raises TypeError

Terry J. Reedy report at bugs.python.org
Sun Jun 26 23:00:07 CEST 2011


Terry J. Reedy <tjreedy at udel.edu> added the comment:

The original bug claim is invalid. But the following (3.2.0, winxp) strike me as a bug, hence the title change

>>> class A: pass

>>> '' % A()
''
>>> '' % object()
...
TypeError: not all arguments converted during string formatting

More difference:

>>> '%(a)s' % object()
...
TypeError: format requires a mapping
>>> '%(a)s' % A()
...
TypeError: 'A' object is not subscriptable

----------
nosy: +terry.reedy
title: No conversion specifier in the string, no __getitem__ method in the right hand value -> '' % object() raises TypeError
versions: +Python 3.2, Python 3.3 -Python 2.6, Python 3.0, Python 3.1

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


More information about the Python-bugs-list mailing list