[Python-checkins] cpython: Fix PyObject_Repr(): don't call PyUnicode_READY() if res is NULL
victor.stinner
python-checkins at python.org
Thu Dec 1 03:20:10 CET 2011
http://hg.python.org/cpython/rev/0d1536ec44e8
changeset: 73804:0d1536ec44e8
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Thu Dec 01 03:22:44 2011 +0100
summary:
Fix PyObject_Repr(): don't call PyUnicode_READY() if res is NULL
files:
Objects/object.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Objects/object.c b/Objects/object.c
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -378,7 +378,9 @@
return PyUnicode_FromFormat("<%s object at %p>",
v->ob_type->tp_name, v);
res = (*v->ob_type->tp_repr)(v);
- if (res != NULL && !PyUnicode_Check(res)) {
+ if (res == NULL)
+ return NULL;
+ if (!PyUnicode_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__repr__ returned non-string (type %.200s)",
res->ob_type->tp_name);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list