Skip to content

Commit

Permalink
internal commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Peter committed Oct 4, 2024
1 parent 525d9fd commit 5e397c2
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions spyder_kernels/customize/spyderpdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

logger = logging.getLogger(__name__)

PDB_INTERNAL_COMMANDS = [
"_pdbcmd_print_frame_status",
]


class DebugWrapper:
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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):
Expand Down

0 comments on commit 5e397c2

Please sign in to comment.