From 5e397c2dd77431cd9a8b250b7c3d0eb115b6e6be Mon Sep 17 00:00:00 2001 From: Quentin Peter Date: Fri, 4 Oct 2024 06:37:20 -0400 Subject: [PATCH] internal commands --- spyder_kernels/customize/spyderpdb.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/spyder_kernels/customize/spyderpdb.py b/spyder_kernels/customize/spyderpdb.py index fa7c7723..5e86a1cd 100755 --- a/spyder_kernels/customize/spyderpdb.py +++ b/spyder_kernels/customize/spyderpdb.py @@ -33,6 +33,10 @@ logger = logging.getLogger(__name__) +PDB_INTERNAL_COMMANDS = [ + "_pdbcmd_print_frame_status", +] + class DebugWrapper: """ @@ -167,7 +171,9 @@ def default(self, line): global_ns[cmd], ZMQExitAutocall): # Use the pdb call cmd_in_namespace = False - cmd_func = getattr(self, 'do_' + cmd, None) + if cmd not in PDB_INTERNAL_COMMANDS: + cmd = 'do_' + cmd + cmd_func = getattr(self, cmd, None) is_pdb_cmd = cmd_func is not None # Look for assignment is_assignment = False @@ -610,14 +616,6 @@ def user_return(self, frame, return_value): def _cmdloop(self): """Modifies the error text.""" - # Interaction in python 3.12.? adds _pdbcmd_print_frame_status - # That we must patch if self.pdb_use_exclamation_mark - if ( - self.pdb_use_exclamation_mark - and self.cmdqueue - and self.cmdqueue[-1] == '_pdbcmd_print_frame_status' - ): - self.cmdqueue[-1] = '!_pdbcmd_print_frame_status' self.interrupting = False while True: try: @@ -631,12 +629,6 @@ def _cmdloop(self): print("--KeyboardInterrupt--\n" "For copying text while debugging, use Ctrl+Shift+C", file=self.stdout) - if ( - self.cmdqueue - and self.cmdqueue[-1] == '!_pdbcmd_print_frame_status' - ): - # If !_pdbcmd_print_frame_status is not used, pop it out - self.cmdqueue.pop() @lru_cache def canonic(self, filename):