diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2004-06-11 14:41:18 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2004-06-11 14:41:18 (GMT) |
commit | 3ecdb250afb74f77b1148dea2bf08775f9de2ab3 (patch) | |
tree | bc4c888a8906ceca0be3563791f350b6813cf956 /Objects | |
parent | 51ffac6db7a97efa4e1593583fa66a98b5a9f904 (diff) | |
download | cpython-3ecdb250afb74f77b1148dea2bf08775f9de2ab3.zip cpython-3ecdb250afb74f77b1148dea2bf08775f9de2ab3.tar.gz cpython-3ecdb250afb74f77b1148dea2bf08775f9de2ab3.tar.bz2 |
Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.
Bugfix candidate, will backport.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 818572f..ee6e5d9 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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; } |