mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440) (#115459)
gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (GH-115440)
(cherry picked from commit bb791c7728
)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
This commit is contained in:
parent
59317167eb
commit
13af281a53
5 changed files with 23 additions and 1 deletions
|
@ -1124,7 +1124,7 @@ class DocTestFinder:
|
|||
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__
|
||||
obj = inspect.unwrap(obj).__code__
|
||||
if inspect.istraceback(obj): obj = obj.tb_frame
|
||||
if inspect.isframe(obj): obj = obj.f_code
|
||||
if inspect.iscode(obj):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue