Commit 4518823a authored by Guido van Rossum's avatar Guido van Rossum

In whichmodule(), use __module__ if set.

parent b6c935a9
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment