inspect: Fix getsource() to support decorated functions.

Issue #1764286. Patch by Claudiu Popa.
This commit is contained in:
Yury Selivanov 2014-09-26 17:34:54 -04:00
parent 2c0a916061
commit 081bbf6b28
4 changed files with 20 additions and 0 deletions

View file

@ -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