summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 0c881b7..5093452 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -298,10 +298,13 @@ type_set_name(PyTypeObject *type, PyObject *value, void *context)
Py_INCREF(value);
- Py_DECREF(et->ht_name);
+ /* Wait until et is a sane state before Py_DECREF'ing the old et->ht_name
+ value. (Bug #16447.) */
+ tmp = et->ht_name;
et->ht_name = value;
type->tp_name = tp_name;
+ Py_DECREF(tmp);
return 0;
}