mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
type.__abstractmethods__ should raise an AttributeError #10006
This commit is contained in:
parent
ea8676bf8b
commit
aec5fd1397
3 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue