diff options
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-x | Lib/pdb.py | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -107,15 +107,6 @@ def find_function(funcname, filename): return funcname, filename, lineno return None -def getsourcelines(obj): - lines, lineno = inspect.findsource(obj) - if inspect.isframe(obj) and obj.f_globals is obj.f_locals: - # must be a module frame: do not try to cut a block out of it - return lines, 1 - elif inspect.ismodule(obj): - return lines, 1 - return inspect.getblock(lines[lineno:]), lineno+1 - def lasti2lineno(code, lasti): linestarts = list(dis.findlinestarts(code)) linestarts.reverse() @@ -1357,7 +1348,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): filename = self.curframe.f_code.co_filename breaklist = self.get_file_breaks(filename) try: - lines, lineno = getsourcelines(self.curframe) + lines, lineno = inspect.getsourcelines(self.curframe) except OSError as err: self.error(err) return @@ -1373,7 +1364,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): except: return try: - lines, lineno = getsourcelines(obj) + lines, lineno = inspect.getsourcelines(obj) except (OSError, TypeError) as err: self.error(err) return |