mirror of
https://github.com/python/cpython.git
synced 2025-11-09 18:11:38 +00:00
gh-99433: Fix doctest failure on types.MethodWrapperType (GH-99434)
(cherry picked from commit 79c10b7da8)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
dd520e7bae
commit
c88a83e7d8
3 changed files with 6 additions and 1 deletions
|
|
@ -956,7 +956,8 @@ def _from_module(self, module, object):
|
||||||
return module is inspect.getmodule(object)
|
return module is inspect.getmodule(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) or
|
||||||
|
inspect.ismethodwrapper(object)):
|
||||||
if hasattr(object, '__objclass__'):
|
if hasattr(object, '__objclass__'):
|
||||||
obj_mod = object.__objclass__.__module__
|
obj_mod = object.__objclass__.__module__
|
||||||
elif hasattr(object, '__module__'):
|
elif hasattr(object, '__module__'):
|
||||||
|
|
|
||||||
|
|
@ -48,3 +48,6 @@ def method_with_doctest(self):
|
||||||
>>> MethodWrapper.method_with_doctest.__name__
|
>>> MethodWrapper.method_with_doctest.__name__
|
||||||
'method_with_doctest'
|
'method_with_doctest'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# https://github.com/python/cpython/issues/99433
|
||||||
|
str_wrapper = object().__str__
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Fix :mod:`doctest` failure on :class:`types.MethodWrapperType` in modules.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue