summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 78d0ce5..f11fc55 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -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