We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4fa631 commit efb497bCopy full SHA for efb497b
1 file changed
Objects/object.c
@@ -1295,6 +1295,7 @@ _PyObject_SetAttributeErrorContext(PyObject* v, PyObject* name)
1295
// Augment the exception with the name and object
1296
if (PyObject_SetAttr(exc, &_Py_ID(name), name) ||
1297
PyObject_SetAttr(exc, &_Py_ID(obj), v)) {
1298
+ Py_DECREF(exc);
1299
return 1;
1300
}
1301
restore:
@@ -3077,9 +3078,9 @@ Py_ReprEnter(PyObject *obj)
3077
3078
list = PyList_New(0);
3079
if (list == NULL)
3080
return -1;
- if (PyDict_SetItem(dict, &_Py_ID(Py_Repr), list) < 0)
3081
+ if (_PyDict_SetItem_Take(dict, &_Py_ID(Py_Repr), list) < 0) {
3082
- Py_DECREF(list);
3083
+ }
3084
3085
i = PyList_GET_SIZE(list);
3086
while (--i >= 0) {
0 commit comments