diff options
author | Guido van Rossum <guido@python.org> | 1997-09-28 05:38:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-09-28 05:38:51 (GMT) |
commit | 4518823ad0e7a408ef664dcebe8907ca66b72750 (patch) | |
tree | a0172c4098bf5a6b6dfb5d5ec6c5d9cbf7047821 /Modules/cPickle.c | |
parent | b6c935a933cc39ea23d867f2367b398efda7f064 (diff) | |
download | cpython-4518823ad0e7a408ef664dcebe8907ca66b72750.zip cpython-4518823ad0e7a408ef664dcebe8907ca66b72750.tar.gz cpython-4518823ad0e7a408ef664dcebe8907ca66b72750.tar.bz2 |
In whichmodule(), use __module__ if set.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r-- | Modules/cPickle.c | 4 |
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; |