Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.
Core and builtins
-----------------
+- Bug #966623. classes created with type() in an exec(, {}) don't
+ have a __module__, but code in typeobject assumed it would always
+ be there.
+
- Bug #952807: Unpickling pickled instances of subclasses of
datetime.date, datetime.datetime and datetime.time could yield insane
objects. Thanks to Jiwon Seo for a fix.
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;
}