[issue7267] format method: c presentation type broken

Walter Dörwald report at bugs.python.org
Fri Nov 6 15:52:32 CET 2009


Walter Dörwald <walter at livinglogic.de> added the comment:

I'd say that a value >= 128 should generate a Unicode string (as the PEP
explicitely states that the value is a Unicode code point and not a byte
value).

However str.format() doesn't seem to support mixing str and unicode anyway:

>>> '{0}'.format(u'\u3042')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u3042' in
position 0: ordinal not in range(128)

so str.format() might raise an OverflowError for values >= 128 (or >= 256?)

----------

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


More information about the Python-bugs-list mailing list