summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 995547e..9ea458f 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -9137,13 +9137,15 @@ type_new_set_names(PyTypeObject *type)
Py_DECREF(set_name);
if (res == NULL) {
- _PyErr_FormatFromCause(PyExc_RuntimeError,
+ _PyErr_FormatNote(
"Error calling __set_name__ on '%.100s' instance %R "
"in '%.100s'",
Py_TYPE(value)->tp_name, key, type->tp_name);
goto error;
}
- Py_DECREF(res);
+ else {
+ Py_DECREF(res);
+ }
}
Py_DECREF(names_to_set);