|
7 | 7 |
|
8 | 8 | """Spyder debugger.""" |
9 | 9 |
|
| 10 | +from __future__ import annotations |
| 11 | + |
10 | 12 | import ast |
11 | 13 | import bdb |
12 | 14 | import builtins |
13 | 15 | from contextlib import contextmanager |
| 16 | +from collections import namedtuple |
| 17 | +from functools import lru_cache |
14 | 18 | import logging |
15 | 19 | import os |
16 | 20 | import sys |
17 | 21 | import traceback |
18 | 22 | import threading |
19 | | -from collections import namedtuple |
20 | | -from functools import lru_cache |
| 23 | +import typing |
21 | 24 |
|
22 | 25 | from IPython.core.autocall import ZMQExitAutocall |
23 | 26 | from IPython.core.debugger import Pdb as ipyPdb |
|
27 | 30 | from spyder_kernels.comms.commbase import stacksummary_to_json |
28 | 31 | from spyder_kernels.comms.frontendcomm import CommError, frontend_request |
29 | 32 | from spyder_kernels.customize.utils import ( |
30 | | - path_is_library, capture_last_Expr, exec_encapsulate_locals |
| 33 | + path_is_library, |
| 34 | + capture_last_Expr, |
| 35 | + exec_encapsulate_locals, |
31 | 36 | ) |
32 | 37 |
|
33 | 38 |
|
| 39 | +if typing.TYPE_CHECKING: |
| 40 | + from spyder_kernels.console.shell import SpyderShell |
| 41 | + |
| 42 | + |
34 | 43 | logger = logging.getLogger(__name__) |
35 | 44 |
|
36 | 45 |
|
@@ -85,7 +94,9 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, |
85 | 94 | self._exclamation_warning_printed = False |
86 | 95 | self.pdb_stop_first_line = True |
87 | 96 | self._disable_next_stack_entry = False |
88 | | - super(SpyderPdb, self).__init__() |
| 97 | + self.shell: SpyderShell | None = None |
| 98 | + |
| 99 | + super().__init__() |
89 | 100 |
|
90 | 101 | # content of tuple: (filename, line number) |
91 | 102 | self._previous_step = None |
@@ -248,11 +259,6 @@ def interrupt(self): |
248 | 259 | self.message("\nProgram interrupted. (Use 'cont' to resume).") |
249 | 260 | self.set_step() |
250 | 261 |
|
251 | | - def set_trace(self, frame=None): |
252 | | - """Register that debugger is tracing.""" |
253 | | - self.shell.add_pdb_session(self) |
254 | | - super(SpyderPdb, self).set_trace(frame) |
255 | | - |
256 | 262 | def set_quit(self): |
257 | 263 | """Register that debugger is not tracing.""" |
258 | 264 | self.shell.remove_pdb_session(self) |
|
0 commit comments