diff -r d6e35146ae53 Lib/inspect.py --- a/Lib/inspect.py Sun Sep 29 01:49:07 2013 +0200 +++ b/Lib/inspect.py Sun Sep 29 12:44:49 2013 +0300 @@ -793,6 +793,7 @@ 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 diff -r d6e35146ae53 Lib/test/inspect_fodder2.py --- a/Lib/test/inspect_fodder2.py Sun Sep 29 01:49:07 2013 +0200 +++ b/Lib/test/inspect_fodder2.py Sun Sep 29 12:44:49 2013 +0300 @@ -109,3 +109,16 @@ #line 109 def keyword_only_arg(*, arg): pass + +from functools import wraps + +def decorator(func): + @wraps(func) + def fake(): + return 42 + return fake + +#line 121 +@decorator +def real(): + return 20 diff -r d6e35146ae53 Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py Sun Sep 29 01:49:07 2013 +0200 +++ b/Lib/test/test_inspect.py Sun Sep 29 12:44:49 2013 +0300 @@ -349,6 +349,9 @@ def test_replacing_decorator(self): self.assertSourceEqual(mod2.gone, 9, 10) + def test_getsource_unwrap(self): + self.assertSourceEqual(mod2.real, 122, 124) + class TestOneliners(GetSourceBase): fodderModule = mod2 def test_oneline_lambda(self):