Kaydet (Commit) 4a671fe6 authored tarafından Brett Cannon's avatar Brett Cannon

Return None to signal that the module the object was defined in was not found…

Return None to signal that the module the object was defined in was not found when object has no __name__ attr but is needed to figure out location of object.
üst 424a4159
......@@ -383,6 +383,8 @@ def getmodule(object):
if file in modulesbyfile:
return sys.modules.get(modulesbyfile[file])
main = sys.modules['__main__']
if not hasattr(object, '__name__'):
return None
if hasattr(main, object.__name__):
mainobject = getattr(main, object.__name__)
if mainobject is object:
......
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