diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-18 01:00:45 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-18 01:00:45 +0200 |
commit | d2f8f1bf739a09dce0d2e88da25a86f4b75eae66 (patch) | |
tree | d911862f63ac31bb3b8f6fbf4fe864d68f3b9f53 /Objects/dictobject.c | |
parent | 26a9578b92eb2ed179d488f6a2eb416ffcdb58f4 (diff) | |
download | cpython-d2f8f1bf739a09dce0d2e88da25a86f4b75eae66.tar.gz |
Issue #18408: Fix dict_repr(), don't call PyObject_Repr() with an exception set
PyObject_Repr() can removes the current exception. For example, module_repr()
calls PyErr_Clear() if calling loader.module_repr(mod) failed.
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 3243061b68..36c710ed5b 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1443,6 +1443,9 @@ dict_repr(PyDictObject *mp) Py_INCREF(value); s = PyObject_Repr(key); PyUnicode_Append(&s, colon); + if (s == NULL) + goto Done; + PyUnicode_AppendAndDel(&s, PyObject_Repr(value)); Py_DECREF(key); Py_DECREF(value); |