[Python-checkins] cpython (3.3): Issue #16856: Fix a segmentation fault from calling repr() on a dict with

serhiy.storchaka python-checkins at python.org
Fri Jan 4 11:42:04 CET 2013


http://hg.python.org/cpython/rev/3cee61137598
changeset:   81279:3cee61137598
branch:      3.3
parent:      81275:c06b4a6afa42
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Jan 04 12:39:34 2013 +0200
summary:
  Issue #16856: Fix a segmentation fault from calling repr() on a dict with
a key whose repr raise an exception.

files:
  Misc/NEWS               |  3 +++
  Objects/unicodeobject.c |  2 +-
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Issue #16856: Fix a segmentation fault from calling repr() on a dict with
+  a key whose repr raise an exception.
+
 - Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB.
 
 - Issue #16455: On FreeBSD and Solaris, if the locale is C, the
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10672,7 +10672,7 @@
         return;
     }
     left = *p_left;
-    if (right == NULL || !PyUnicode_Check(left)) {
+    if (right == NULL || left == NULL || !PyUnicode_Check(left)) {
         if (!PyErr_Occurred())
             PyErr_BadInternalCall();
         goto error;

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


More information about the Python-checkins mailing list