mirror of
https://github.com/python/cpython.git
synced 2025-10-08 08:01:55 +00:00
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
1 changed files with 7 additions and 1 deletions
|
@ -945,7 +945,13 @@ class DocTestFinder:
|
||||||
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…
Add table
Add a link
Reference in a new issue