summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-10-31 04:04:42 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-10-31 04:04:42 (GMT)
commit3cb90241fc9d95612879bd8f479c7a059108ef0a (patch)
tree7a9088caaefcb2ea651c78ab426542dd2b8e684b /Objects
parent42124a727d0516e8b98b4b2d3dbae4044d34a836 (diff)
parent2c05a2e01b18e9d10cd153308c4866909631e8c0 (diff)
downloadcpython-3cb90241fc9d95612879bd8f479c7a059108ef0a.zip
cpython-3cb90241fc9d95612879bd8f479c7a059108ef0a.tar.gz
cpython-3cb90241fc9d95612879bd8f479c7a059108ef0a.tar.bz2
merge 3.3
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c11
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;