diff -r 82ba1f46def5 Lib/inspect.py --- a/Lib/inspect.py Thu Sep 27 20:07:45 2012 +1000 +++ b/Lib/inspect.py Sun Sep 30 10:48:17 2012 -0400 @@ -1125,7 +1125,7 @@ except IOError: lines = index = None else: - start = max(start, 1) + start = max(start, 0) start = max(0, min(start, len(lines) - context)) lines = lines[start:start+context] index = lineno - 1 - start diff -r 82ba1f46def5 Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py Thu Sep 27 20:07:45 2012 +1000 +++ b/Lib/test/test_inspect.py Sun Sep 30 10:48:17 2012 -0400 @@ -274,6 +274,9 @@ # Check filename override self.assertEqual(inspect.getmodule(None, modfile), mod) + def test_getframeinfo(self): + self.assertEqual(inspect.getframeinfo(mod.fr, 50).code_context[0], "# line 1\n") + def test_getsource(self): self.assertSourceEqual(git.abuse, 29, 39) self.assertSourceEqual(mod.StupidGit, 21, 46)