11# -*- coding: utf-8 -*-
22#
3- # Copyright (C) 2008-2010, 2013-2021, 2023-2024 Rocky Bernstein
3+ # Copyright (C) 2008-2010, 2013-2021, 2023-2025 Rocky Bernstein
4455#
66# This program is free software: you can redistribute it and/or modify
4040import trepan .misc as Mmisc
4141from trepan .interfaces .script import ScriptInterface
4242from trepan .lib .bytecode import is_class_def , is_def_stmt
43- from trepan .processor .print import print_location
4443from trepan .processor .complete_rl import completer
44+ from trepan .processor .print import print_location
4545from trepan .vprocessor import Processor
4646
4747
@@ -159,9 +159,6 @@ def get_option_fn(key):
159159 super ().__init__ (core_obj )
160160
161161 self .aliases = {}
162- # "contine_running" is used by step/next/contine to signal breaking out of
163- # the command evaluation loop.
164- self .continue_running = False
165162
166163 # "fast_continue" is used if we should try to see if we can
167164 # remove the debugger callback hook altogether. It is used by
@@ -243,7 +240,9 @@ def get_option_fn(key):
243240
244241 for cmd , cmd_obj in self .commands .items ():
245242 if hasattr (cmd_obj , "cmds" ) and hasattr (cmd_obj .cmds , "cmdlist" ):
246- trepan3k_completer .add_completions (cmd , sorted (cmd_obj .cmds .cmdlist ))
243+ trepan3k_completer .add_completions (
244+ cmd , sorted (cmd_obj .cmds .cmdlist )
245+ )
247246 for subcmd_name , subcmd_obj in cmd_obj .cmds .subcmds .items ():
248247 subcmd_key = f"{ cmd } { subcmd_name } "
249248 if hasattr (subcmd_obj , "completion_choices" ):
@@ -269,7 +268,7 @@ def _saferepr(self, str, maxwidth=None):
269268 maxwidth = self .debugger .settings ["width" ]
270269 return self ._repr .repr (str )[:maxwidth ]
271270
272- def add_preloop_hook (self , hook , position = - 1 , nodups = True ):
271+ def add_preloop_hook (self , hook , position = - 1 , _ = True ):
273272 if hook in self .preloop_hooks :
274273 return False
275274 self .preloop_hooks .insert (position , hook )
@@ -282,8 +281,10 @@ def add_remap_pat(self, pat, replace, clear_remap=True):
282281 pyficache .file2file_remap = {}
283282
284283 # To be overridden in derived debuggers
285- def defaultFile (self ):
284+ def defaultFile (self ) -> Optional [ str ] :
286285 """Produce a reasonable default."""
286+ if self .curframe is None :
287+ return None
287288 filename = self .curframe .f_code .co_filename
288289 # Consider using is_exec_stmt(). I just don't understand
289290 # the conditions under which the below test is true.
0 commit comments