mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
inspect: Fix getsource() to support decorated functions.
Issue #1764286. Patch by Claudiu Popa.
This commit is contained in:
parent
2c0a916061
commit
081bbf6b28
4 changed files with 20 additions and 0 deletions
|
@ -817,6 +817,7 @@ def getsourcelines(object):
|
|||
corresponding to the object and the line number indicates where in the
|
||||
original source file the first line of code was found. An OSError is
|
||||
raised if the source code cannot be retrieved."""
|
||||
object = unwrap(object)
|
||||
lines, lnum = findsource(object)
|
||||
|
||||
if ismodule(object): return lines, 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue