From 6c83e739d7b1690f8763b2437266effa71173324 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 4 Jan 2013 12:39:34 +0200 Subject: [PATCH] Issue #16856: Fix a segmentation fault from calling repr() on a dict with a key whose repr raise an exception. --- Misc/NEWS | 3 +++ Objects/unicodeobject.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 41126a6e436..5741620f113 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ What's New in Python 3.3.1? 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 index 3b307ed1d9b..1522a16ba6e 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10672,7 +10672,7 @@ PyUnicode_Append(PyObject **p_left, PyObject *right) 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;