@@ -398,13 +398,6 @@ def setup(self, f, tb):
398398            self .tb_lineno [tb .tb_frame ] =  lineno 
399399            tb  =  tb .tb_next 
400400        self .curframe  =  self .stack [self .curindex ][0 ]
401-         # The f_locals dictionary used to be updated from the actual frame 
402-         # locals whenever the .f_locals accessor was called, so it was 
403-         # cached here to ensure that modifications were not overwritten. While 
404-         # the caching is no longer required now that f_locals is a direct proxy 
405-         # on optimized frames, it's also harmless, so the code structure has 
406-         # been left unchanged. 
407-         self .curframe_locals  =  self .curframe .f_locals 
408401        self .set_convenience_variable (self .curframe , '_frame' , self .curframe )
409402
410403        if  self ._chained_exceptions :
@@ -727,7 +720,7 @@ def _exec_in_closure(self, source, globals, locals):
727720
728721    def  default (self , line ):
729722        if  line [:1 ] ==  '!' : line  =  line [1 :].strip ()
730-         locals  =  self .curframe_locals 
723+         locals  =  self .curframe . f_locals 
731724        globals  =  self .curframe .f_globals 
732725        try :
733726            buffer  =  line 
@@ -955,7 +948,7 @@ def _complete_expression(self, text, line, begidx, endidx):
955948        # Collect globals and locals.  It is usually not really sensible to also 
956949        # complete builtins, and they clutter the namespace quite heavily, so we 
957950        # leave them out. 
958-         ns  =  {** self .curframe .f_globals , ** self .curframe_locals }
951+         ns  =  {** self .curframe .f_globals , ** self .curframe . f_locals }
959952        if  text .startswith ("$" ):
960953            # Complete convenience variables 
961954            conv_vars  =  self .curframe .f_globals .get ('__pdb_convenience_variables' , {})
@@ -986,7 +979,7 @@ def completedefault(self, text, line, begidx, endidx):
986979        # Use rlcompleter to do the completion 
987980        state  =  0 
988981        matches  =  []
989-         completer  =  Completer (self .curframe .f_globals  |  self .curframe_locals )
982+         completer  =  Completer (self .curframe .f_globals  |  self .curframe . f_locals )
990983        while  (match  :=  completer .complete (text , state )) is  not None :
991984            matches .append (match )
992985            state  +=  1 
@@ -1148,7 +1141,7 @@ def do_break(self, arg, temporary = 0):
11481141                try :
11491142                    func  =  eval (arg ,
11501143                                self .curframe .f_globals ,
1151-                                 self .curframe_locals )
1144+                                 self .curframe . f_locals )
11521145                except :
11531146                    func  =  arg 
11541147                try :
@@ -1453,7 +1446,6 @@ def _select_frame(self, number):
14531446        assert  0  <=  number  <  len (self .stack )
14541447        self .curindex  =  number 
14551448        self .curframe  =  self .stack [self .curindex ][0 ]
1456-         self .curframe_locals  =  self .curframe .f_locals 
14571449        self .set_convenience_variable (self .curframe , '_frame' , self .curframe )
14581450        self .print_stack_entry (self .stack [self .curindex ])
14591451        self .lineno  =  None 
@@ -1694,7 +1686,7 @@ def do_debug(self, arg):
16941686        """ 
16951687        sys .settrace (None )
16961688        globals  =  self .curframe .f_globals 
1697-         locals  =  self .curframe_locals 
1689+         locals  =  self .curframe . f_locals 
16981690        p  =  Pdb (self .completekey , self .stdin , self .stdout )
16991691        p .prompt  =  "(%s) "  %  self .prompt .strip ()
17001692        self .message ("ENTERING RECURSIVE DEBUGGER" )
@@ -1739,7 +1731,7 @@ def do_args(self, arg):
17391731            self ._print_invalid_arg (arg )
17401732            return 
17411733        co  =  self .curframe .f_code 
1742-         dict  =  self .curframe_locals 
1734+         dict  =  self .curframe . f_locals 
17431735        n  =  co .co_argcount  +  co .co_kwonlyargcount 
17441736        if  co .co_flags  &  inspect .CO_VARARGS : n  =  n + 1 
17451737        if  co .co_flags  &  inspect .CO_VARKEYWORDS : n  =  n + 1 
@@ -1759,23 +1751,23 @@ def do_retval(self, arg):
17591751        if  arg :
17601752            self ._print_invalid_arg (arg )
17611753            return 
1762-         if  '__return__'  in  self .curframe_locals :
1763-             self .message (self ._safe_repr (self .curframe_locals ['__return__' ], "retval" ))
1754+         if  '__return__'  in  self .curframe . f_locals :
1755+             self .message (self ._safe_repr (self .curframe . f_locals ['__return__' ], "retval" ))
17641756        else :
17651757            self .error ('Not yet returned!' )
17661758    do_rv  =  do_retval 
17671759
17681760    def  _getval (self , arg ):
17691761        try :
1770-             return  eval (arg , self .curframe .f_globals , self .curframe_locals )
1762+             return  eval (arg , self .curframe .f_globals , self .curframe . f_locals )
17711763        except :
17721764            self ._error_exc ()
17731765            raise 
17741766
17751767    def  _getval_except (self , arg , frame = None ):
17761768        try :
17771769            if  frame  is  None :
1778-                 return  eval (arg , self .curframe .f_globals , self .curframe_locals )
1770+                 return  eval (arg , self .curframe .f_globals , self .curframe . f_locals )
17791771            else :
17801772                return  eval (arg , frame .f_globals , frame .f_locals )
17811773        except  BaseException  as  exc :
@@ -2019,7 +2011,7 @@ def do_interact(self, arg):
20192011        Start an interactive interpreter whose global namespace 
20202012        contains all the (global and local) names found in the current scope. 
20212013        """ 
2022-         ns  =  {** self .curframe .f_globals , ** self .curframe_locals }
2014+         ns  =  {** self .curframe .f_globals , ** self .curframe . f_locals }
20232015        console  =  _PdbInteractiveConsole (ns , message = self .message )
20242016        console .interact (banner = "*pdb interact start*" ,
20252017                         exitmsg = "*exit from pdb interact command*" )
0 commit comments