diff options
| author | Benjamin Peterson <benjamin@python.org> | 2012-10-30 23:51:03 -0400 |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2012-10-30 23:51:03 -0400 |
| commit | 8afa7fa51064848d826e4eb8a2bd46cf7f730b0f (patch) | |
| tree | ef0fb644e04cbf28714579ef0985a1cd9d951354 /Objects/typeobject.c | |
| parent | e8ea97fffb591cd71090d0f3114bf1d3bcd31454 (diff) | |
| download | cpython-git-8afa7fa51064848d826e4eb8a2bd46cf7f730b0f.tar.gz | |
don't shadow the __qualname__ descriptor with __qualname__ in the class's __dict__ (closes #16271)
Diffstat (limited to 'Objects/typeobject.c')
| -rw-r--r-- | Objects/typeobject.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 5d625a21ea..9f0d13e369 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2250,11 +2250,10 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) goto error; } } - else { - qualname = et->ht_name; - } - Py_INCREF(qualname); - et->ht_qualname = qualname; + et->ht_qualname = qualname ? qualname : et->ht_name; + Py_INCREF(et->ht_qualname); + if (qualname != NULL && PyDict_DelItem(dict, PyId___qualname__.object) < 0) + goto error; /* Set tp_doc to a copy of dict['__doc__'], if the latter is there and is a string. The __doc__ accessor will first look for tp_doc; |
