mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
4755beac3c
commit
f97dfd7b59
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue