mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-61648: Detect line numbers of properties in doctests (GH-113161)
This commit is contained in:
parent
737d23ffcd
commit
8f8f0f97e1
4 changed files with 21 additions and 0 deletions
|
@ -1136,6 +1136,8 @@ class DocTestFinder:
|
|||
|
||||
# Find the line number for functions & methods.
|
||||
if inspect.ismethod(obj): obj = obj.__func__
|
||||
if isinstance(obj, property):
|
||||
obj = obj.fget
|
||||
if inspect.isfunction(obj) and getattr(obj, '__doc__', None):
|
||||
# We don't use `docstring` var here, because `obj` can be changed.
|
||||
obj = obj.__code__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue