[New-bugs-announce] [issue1028] Tkinter binding involving Control-spacebar raises unicode error

Kurt B. Kaiser report at bugs.python.org
Sun Aug 26 22:48:31 CEST 2007


New submission from Kurt B. Kaiser:

The control-spacebar binding is used in IDLE to 
force open the completions window.  It's causing 
IDLE to exit with a utf8 decode error.  Attached 
is 
a Tkinter cut-down 
exhibiting the problem and a patch.

The cutdown runs ok on 2.6 but not on py3k because 
the latter uses PyUnicode_FromString on all the 
arguments and errs out when it encounters a 
character outside the utf-8 range.

Strangely, on my system, control-spacebar is 
sending a two byte 
string, C0E8 via the %A parameter.  Control-2 
does 
the same.  Other keys with combinations of 
modifier 
keys send one byte.

Linux trader 2.6.18-ARCH #1 SMP PREEMPT Sun Nov 
19 
09:14:35 CET 2006 i686 Intel(R) Pentium(R) 4 CPU 
2.40GHz GenuineIntel GNU/Linux

Can the problem be confirmed?

Using PyUnicode_FromUnicode on %A works because 
the 
unicode string is copied instead of decoded, and 
that parameter is supposed to be unicode, in any 
case.

The patch fixes the problem on my system but 
should 
be reviewed, especially whether the cast in the 
call 
to PyUnicode_FromUnicode is suitably cross-
platform.

Assigning to Neal since he's working a lot of 
Unicode issues right now.  I can check it in if I 
get approval.

----------
assignee: nnorwitz
components: Tkinter
files: tkintertest.py
keywords: patch, py3k
messages: 55311
nosy: kbk
severity: normal
status: open
title: Tkinter binding involving Control-spacebar raises unicode error
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1028>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tkintertest.py
Type: application/x-python
Size: 725 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20070826/627d2772/attachment.bin 


More information about the New-bugs-announce mailing list