Fix: __module__ doesn't need to be properly defined.

This commit is contained in:
Dave Halter
2015-12-20 02:35:23 +01:00
parent b2a691a69a
commit 9a93d599da

View File

@@ -68,7 +68,11 @@ def get_module(obj):
# Happens for example in `(_ for _ in []).send.__module__`.
return builtins
else:
return __import__(imp_plz)
try:
return __import__(imp_plz)
except ImportError:
# __module__ can be something arbitrary that doesn't exist.
return builtins
def _faked(module, obj, name):