diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-02 00:03:31 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-02 00:03:31 (GMT) |
commit | aec5fd13979f7fac74a057d7a54c124354a715a2 (patch) | |
tree | 360c95d63deea11da4f3871736b11724273620aa /Objects | |
parent | ea8676bf8b09003e29278af25e495050638fda47 (diff) | |
download | cpython-aec5fd13979f7fac74a057d7a54c124354a715a2.zip cpython-aec5fd13979f7fac74a057d7a54c124354a715a2.tar.gz cpython-aec5fd13979f7fac74a057d7a54c124354a715a2.tar.bz2 |
type.__abstractmethods__ should raise an AttributeError #10006
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 7bdcb12..c8c198d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -320,8 +320,11 @@ type_set_module(PyTypeObject *type, PyObject *value, void *context) static PyObject * type_abstractmethods(PyTypeObject *type, void *context) { - PyObject *mod = PyDict_GetItemString(type->tp_dict, - "__abstractmethods__"); + PyObject *mod = NULL; + /* type its self has an __abstractmethods__ descriptor (this). Don't + return that. */ + if (type != &PyType_Type) + mod = PyDict_GetItemString(type->tp_dict, "__abstractmethods__"); if (!mod) { PyErr_Format(PyExc_AttributeError, "__abstractmethods__"); return NULL; |