[Python-checkins] cpython (merge 3.1 -> 3.2): Merge from 3.1

kurt.kaiser python-checkins at python.org
Wed May 11 20:19:55 CEST 2011


http://hg.python.org/cpython/rev/65a6a2f8721f
changeset:   70040:65a6a2f8721f
branch:      3.2
parent:      70035:5add0c01933f
parent:      70039:82cfbe2ddfbb
user:        Kurt B. Kaiser <kbk at shore.net>
date:        Wed May 11 13:48:54 2011 -0400
summary:
  Merge from 3.1

files:
  Lib/idlelib/NEWS.txt |   9 ++++++---
  Misc/NEWS            |   3 +++
  Modules/_tkinter.c   |  14 +++++++++++++-
  3 files changed, 22 insertions(+), 4 deletions(-)


diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,18 +1,21 @@
 What's New in IDLE 3.1.4?
 =========================
 
-*Release date: XX-XXX-XX*
+*Release date: 15-May-11*
+
+- Issue #1028: Ctrl-space binding to show completions was causing IDLE to exit.
+  Tk < 8.5 was sending invalid Unicode null; replaced with valid null.
 
 - <Home> toggle failing on Tk 8.5, causing IDLE exits and strange selection
   behavior. Issue 4676.  Improve selection extension behaviour.
+
 - <Home> toggle non-functional when NumLock set on Windows.  Issue 3851.
 
 
-
 What's New in IDLE 3.1b1?
 =========================
 
-*Release date: 27-Jun-09*
+*Release date: 06-May-09*
 
 - Use of 'filter' in keybindingDialog.py was causing custom key assignment to
   fail.  Patch 5707 amaury.forgeotdarc.
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -85,6 +85,9 @@
 
 Library
 -------
+- Issue #1028: Tk returns invalid Unicode null in %A: UnicodeDecodeError.
+  With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused
+  IDLE to exit.  Converted to valid Unicode null in PythonCmd().
 
 - Issue #11169: compileall module uses repr() to format filenames and paths to
   escape surrogate characters and show spaces.
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2023,7 +2023,19 @@
 
     for (i = 0; i < (argc - 1); i++) {
         PyObject *s = PyUnicode_FromString(argv[i + 1]);
-        if (!s || PyTuple_SetItem(arg, i, s)) {
+        if (!s) {
+            /* Is Tk leaking 0xC080 in %A - a "modified" utf-8 null? */
+            if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError) &&
+                !strcmp(argv[i + 1], "\xC0\x80")) {
+                PyErr_Clear();
+                /* Convert to "strict" utf-8 null */
+                s = PyUnicode_FromString("\0");
+            } else {
+                Py_DECREF(arg);
+                return PythonCmd_Error(interp);
+            }
+        }
+        if (PyTuple_SetItem(arg, i, s)) {
             Py_DECREF(arg);
             return PythonCmd_Error(interp);
         }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list