[New-bugs-announce] [issue12342] characters with ord above 65535 fail conversion with str.format for '{:c}' in IDLE

wujek report at bugs.python.org
Wed Jun 15 23:00:00 CEST 2011


New submission from wujek <wujek.srujek at googlemail.com>:

The following code produces an exception:

print('{:c}'.format(65536))

when executed in Idle 3.2. The stack trace:

>>> print('{:c}'.format(65536))
Traceback (most recent call last):
  File "<pyshell#149>", line 1, in <module>
    print('{:c}'.format(65536))
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 1231, in write
    self.shell.write(s, self.tags)
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 1213, in write
    OutputWindow.write(self, s, tags, "iomark")
  File "/usr/lib/python3.2/idlelib/OutputWindow.py", line 40, in write
    self.text.insert(mark, s, tags)
  File "/usr/lib/python3.2/idlelib/Percolator.py", line 25, in insert
    self.top.insert(index, chars, tags)
  File "/usr/lib/python3.2/idlelib/ColorDelegator.py", line 79, in insert
    self.delegate.insert(index, chars, tags)
  File "/usr/lib/python3.2/idlelib/PyShell.py", line 316, in insert
    UndoDelegator.insert(self, index, chars, tags)
  File "/usr/lib/python3.2/idlelib/UndoDelegator.py", line 81, in insert
    self.addcmd(InsertCommand(index, chars, tags))
  File "/usr/lib/python3.2/idlelib/UndoDelegator.py", line 116, in addcmd
    cmd.do(self.delegate)
  File "/usr/lib/python3.2/idlelib/UndoDelegator.py", line 219, in do
    text.insert(self.index1, self.chars, self.tags)
  File "/usr/lib/python3.2/idlelib/ColorDelegator.py", line 79, in insert
    self.delegate.insert(index, chars, tags)
  File "/usr/lib/python3.2/idlelib/WidgetRedirector.py", line 104, in __call__
    return self.tk_call(self.orig_and_operation + args)
ValueError: unsupported character

Seems to work fine in a terminal (Gnome-terminal in this case):

>>> print('{:c}'.format(0x10000))
𐀀

(my font doesn't have the glyph, but otherwise it works)



Python version:
>>> print(sys.version)
3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2]

Os:
wujek at home:~$ uname -a
Linux studio 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

wujek at home:~$ cat /etc/issue
Ubuntu 11.04

----------
components: IDLE, IO
messages: 138389
nosy: wujek.srujek
priority: normal
severity: normal
status: open
title: characters with ord above 65535 fail conversion with str.format for '{:c}' in IDLE
type: behavior
versions: Python 3.2

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


More information about the New-bugs-announce mailing list