Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,8 @@ def _from_module(self, module, object):
return module is inspect.getmodule(object)
elif inspect.isfunction(object):
return module.__dict__ is object.__globals__
elif inspect.ismethoddescriptor(object):
elif (inspect.ismethoddescriptor(object) or
inspect.ismethodwrapper(object)):
if hasattr(object, '__objclass__'):
obj_mod = object.__objclass__.__module__
elif hasattr(object, '__module__'):
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/doctest_lineno.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ def method_with_doctest(self):
>>> MethodWrapper.method_with_doctest.__name__
'method_with_doctest'
"""

# https://github.com/python/cpython/issues/99433
str_wrapper = object().__str__
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :mod:`doctest` failure on :class:`types.MethodWrapperType` in modules.