mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case. Bugfix candidate, will backport.
This commit is contained in:
parent
51ffac6db7
commit
3ecdb250af
2 changed files with 8 additions and 0 deletions
|
@ -87,6 +87,10 @@ type_module(PyTypeObject *type, void *context)
|
|||
|
||||
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) {
|
||||
mod = PyDict_GetItemString(type->tp_dict, "__module__");
|
||||
if (!mod) {
|
||||
PyErr_Format(PyExc_AttributeError, "__module__");
|
||||
return 0;
|
||||
}
|
||||
Py_XINCREF(mod);
|
||||
return mod;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue