Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 32323:c1fbbc3eed39 legacy-trunk
Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.
Bugfix candidate, will backport.
| author | Anthony Baxter <anthonybaxter@gmail.com> |
|---|---|
| date | Fri, 11 Jun 2004 14:41:18 +0000 |
| parents | 8184c677713f |
| children | 75e5d1e8b617 |
line wrap: on
line diff
--- a/Objects/typeobject.c Fri Jun 11 04:49:03 2004 +0000 +++ b/Objects/typeobject.c Fri Jun 11 14:41:18 2004 +0000 @@ -87,6 +87,10 @@ 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; }
