mirror of https://github.com/python/cpython.git
Issue #3158: Provide a couple of fallbacks for in case a method_descriptor
doesn't have __objclass__.
This commit is contained in:
parent
a26b3f183d
commit
eee44f28a9
|
@ -945,7 +945,13 @@ def _from_module(self, module, object):
|
||||||
elif inspect.isfunction(object):
|
elif inspect.isfunction(object):
|
||||||
return module.__dict__ is object.__globals__
|
return module.__dict__ is object.__globals__
|
||||||
elif inspect.ismethoddescriptor(object):
|
elif inspect.ismethoddescriptor(object):
|
||||||
return module.__name__ == object.__objclass__.__module__
|
if hasattr(object, '__objclass__'):
|
||||||
|
obj_mod = object.__objclass__.__module__
|
||||||
|
elif hasattr(object, '__module__'):
|
||||||
|
obj_mod = object.__module__
|
||||||
|
else:
|
||||||
|
return True # [XX] no easy way to tell otherwise
|
||||||
|
return module.__name__ == obj_mod
|
||||||
elif inspect.isclass(object):
|
elif inspect.isclass(object):
|
||||||
return module.__name__ == object.__module__
|
return module.__name__ == object.__module__
|
||||||
elif hasattr(object, '__module__'):
|
elif hasattr(object, '__module__'):
|
||||||
|
|
Loading…
Reference in New Issue