diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-10-31 04:04:42 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-10-31 04:04:42 (GMT) |
commit | 3cb90241fc9d95612879bd8f479c7a059108ef0a (patch) | |
tree | 7a9088caaefcb2ea651c78ab426542dd2b8e684b /Objects | |
parent | 42124a727d0516e8b98b4b2d3dbae4044d34a836 (diff) | |
parent | 2c05a2e01b18e9d10cd153308c4866909631e8c0 (diff) | |
download | cpython-3cb90241fc9d95612879bd8f479c7a059108ef0a.zip cpython-3cb90241fc9d95612879bd8f479c7a059108ef0a.tar.gz cpython-3cb90241fc9d95612879bd8f479c7a059108ef0a.tar.bz2 |
merge 3.3
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a790add..fec907e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -311,6 +311,8 @@ type_set_qualname(PyTypeObject *type, PyObject *value, void *context) { PyHeapTypeObject* et; + if (!check_set_special_type_attr(type, value, "__qualname__")) + return -1; if (!PyUnicode_Check(value)) { PyErr_Format(PyExc_TypeError, "can only assign string to %s.__qualname__, not '%s'", @@ -2250,11 +2252,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; |