--- pdb.py 2010-07-12 06:52:35.593750000 +0400 +++ pdb_ 2010-07-12 07:01:49.156250000 +0400 @@ -467,7 +467,8 @@ Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive. """ - line = linecache.getline(filename, lineno, self.curframe.f_globals) + globals = self.curframe.f_globals if hasattr(self,'curframe') else None + line = linecache.getline(filename, lineno, globals) if not line: print >>self.stdout, 'End of file' return 0