Kaydet (Commit) c99e0f18 authored tarafından Ka-Ping Yee's avatar Ka-Ping Yee

Robustify getfile() against classes that lie about their __module__s

    (such as the exceptions in _weakref and _locale!)
üst da79389f
......@@ -173,7 +173,7 @@ def getfile(object):
return object.__file__
raise TypeError, 'arg is a built-in module'
if isclass(object):
object = sys.modules[object.__module__]
object = sys.modules.get(object.__module__)
if hasattr(object, '__file__'):
return object.__file__
raise TypeError, 'arg is a built-in class'
......
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