Skip to content

Commit

Permalink
return without calling _cmdloop() after error
Browse files Browse the repository at this point in the history
a quick fix for
#1
  • Loading branch information
TaiSakuma committed Feb 18, 2022
1 parent f866f09 commit c93e93f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nextline/pdb/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ def trace_dispatch(self, frame, event, arg):

def _cmdloop(self):
"""Prompt user input"""
self._registrar.entering_cmdloop()
try:
self._registrar.entering_cmdloop()
except RuntimeError:
return
super()._cmdloop()
self._registrar.exited_cmdloop()

Expand Down
3 changes: 3 additions & 0 deletions nextline/pdb/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def exited_trace(self) -> None:
self._current_trace_args = None

def entering_cmdloop(self) -> None:
if not self._current_trace_args:
raise RuntimeError("calling_trace() must be called first")

frame, event, _ = self._current_trace_args

module_name = frame.f_globals.get("__name__")
Expand Down

0 comments on commit c93e93f

Please sign in to comment.