commit | 64aafeb4de3b5e85007f2107250e6f1da4df2516 | [log] [tgz] |
---|---|---|
author | Mark Dickinson <dickinsm@gmail.com> | Sat Apr 13 15:26:58 2013 +0100 |
committer | Mark Dickinson <dickinsm@gmail.com> | Sat Apr 13 15:26:58 2013 +0100 |
tree | 39057074fa67114998a802a6e2761e37734ce021 | |
parent | eff64447512b026416fce4e65730e25633a5f1ac [diff] [blame] |
Issue #16447: Fix potential segfault when setting __name__ on a class.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9f89972..6ece741 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c
@@ -298,10 +298,13 @@ 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; }