Skip to content

Commit e1ba420

Browse files
committed
fix: follow another and co-author
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
1 parent cb73cb0 commit e1ba420

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/pdb.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,6 +1332,9 @@ def do_break(self, arg, temporary=False):
13321332
if bp:
13331333
self.message(bp.bpformat())
13341334
return
1335+
if not self.curframe:
1336+
self.error('No current frame.')
1337+
return
13351338
# parse arguments; comma has lowest precedence
13361339
# and cannot occur in filename
13371340
filename = None
@@ -1411,6 +1414,7 @@ def do_break(self, arg, temporary=False):
14111414
# To be overridden in derived debuggers
14121415
def defaultFile(self):
14131416
"""Produce a reasonable default."""
1417+
assert self.curframe is not None
14141418
filename = self.curframe.f_code.co_filename
14151419
if filename == '<string>' and self.mainpyfile:
14161420
filename = self.mainpyfile
@@ -1949,6 +1953,9 @@ def do_debug(self, arg):
19491953
if not arg:
19501954
self._print_invalid_arg(arg)
19511955
return
1956+
if not self.curframe:
1957+
self.error('No current frame.')
1958+
return
19521959
self.stop_trace()
19531960
globals = self.curframe.f_globals
19541961
locals = self.curframe.f_locals

0 commit comments

Comments
 (0)