summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/cPickle.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index b5fddd0..6021a03 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -632,6 +632,10 @@ whichmodule(PyObject *global, PyObject *global_name) {
PyObject *module = 0, *modules_dict = 0,
*global_name_attr = 0, *name = 0;
+ module = PyObject_GetAttrString(global, "__module__");
+ if (module) return module;
+ PyErr_Clear();
+
if ((module = PyDict_GetItem(class_map, global))) {
Py_INCREF(module);
return module;