[Python-checkins] cpython (merge 3.3 -> default): 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:06 CET 2013


http://hg.python.org/cpython/rev/fee4bc043d73
changeset:   81280:fee4bc043d73
parent:      81278:b0926ddcab5e
parent:      81279:3cee61137598
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Jan 04 12:40:35 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
@@ -10,6 +10,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 #16761: Calling int() with base argument only now raises TypeError.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10548,7 +10548,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