diff options
| author | Mark Dickinson <dickinsm@gmail.com> | 2013-04-13 15:26:58 +0100 |
|---|---|---|
| committer | Mark Dickinson <dickinsm@gmail.com> | 2013-04-13 15:26:58 +0100 |
| commit | 64aafeb4de3b5e85007f2107250e6f1da4df2516 (patch) | |
| tree | 39057074fa67114998a802a6e2761e37734ce021 /Objects | |
| parent | eff64447512b026416fce4e65730e25633a5f1ac (diff) | |
| download | cpython-git-64aafeb4de3b5e85007f2107250e6f1da4df2516.tar.gz | |
Issue #16447: Fix potential segfault when setting __name__ on a class.
Diffstat (limited to 'Objects')
| -rw-r--r-- | Objects/typeobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9f89972594..6ece741833 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; } |
