| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. I'm not sure what would happen if you had a class decorator that used functools.wraps(), but I can't think of a realistic reason why you might do that. So I don't think that's worth worrying about right now.
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you!
Sorry, something went wrong.
|
Thanks @brianschubert for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry, something went wrong.
|
Thanks @brianschubert for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, something went wrong.
…orated functions (pythonGH-115440) (cherry picked from commit bb791c7) Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
|
GH-115458 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
…orated functions (pythonGH-115440) (cherry picked from commit bb791c7) Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
|
GH-115459 is a backport of this pull request to the 3.12 branch. |
Sorry, something went wrong.
This is known to fail on Python 3.11.9 because `--doctest-ufunc` was broken for wrapped ufuncs without docstrings by python/cpython#115440.
|
This broke doctest discovery for functions that are wrapped but do not define a __doc__. See scientific-python/pytest-doctestplus#248. |
Sorry, something went wrong.
Would you be able to open a new issue with a minimal repro? |
Sorry, something went wrong.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes line numbers reported by doctest for wrapper functions (such as those returned by functools.wraps).
Currently, doctest.DocTestFinder._find_lineno looks at __code__.co_firstlineno to determine the line number that a function's docstring starts at. This is incorrect for wrapper functions, where the location of the function definition is not the same as the location of the docstring being tested.
Wrapper functions that have been updated with functools.update_wrapper have a __wrapped__ attribute that points to the underlying wrapped function. This PR adds a recursive check for __wrapped__ attributes on function objects to locate the original function that defined the docstring-under-test.