Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 32324:b054cff7bb86 2.3
Backport:
Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.
| author | Anthony Baxter <anthonybaxter@gmail.com> |
|---|---|
| date | Fri, 11 Jun 2004 15:09:41 +0000 |
| parents | f63dd299a60b |
| children | d99b5bed0078 |
line wrap: on
line diff
--- a/Objects/typeobject.c Wed Jun 09 18:33:48 2004 +0000 +++ b/Objects/typeobject.c Fri Jun 11 15:09:41 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; }
