File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1399,14 +1399,17 @@ _PyFrame_LocalsToFast(_PyInterpreterFrame *frame, int clear)
13991399
14001400    PyObject  * exc  =  PyErr_GetRaisedException ();
14011401    for  (int  i  =  0 ; i  <  co -> co_nlocalsplus ; i ++ ) {
1402-         /* Same test as in _PyFrame_GetLocals() above. */ 
1403-         PyObject  * value ; // borrowed reference 
1404-         if  (!frame_get_var (frame , co , i , & value )) {
1402+         _PyLocals_Kind  kind  =  _PyLocals_GetKind (co -> co_localspluskinds , i );
1403+ 
1404+         /* Same test as in PyFrame_FastToLocals() above. */ 
1405+         if  (kind  &  CO_FAST_FREE  &&  !(co -> co_flags  &  CO_OPTIMIZED )) {
1406+             continue ;
1407+         }
1408+         if  (kind  &  CO_FAST_HIDDEN ) {
14051409            continue ;
14061410        }
1407- 
14081411        PyObject  * name  =  PyTuple_GET_ITEM (co -> co_localsplusnames , i );
1409-         _PyLocals_Kind   kind  =  _PyLocals_GetKind ( co -> co_localspluskinds ,  i );
1412+         PyObject   * value  =  PyObject_GetItem ( locals ,  name );
14101413        /* We only care about NULLs if clear is true. */ 
14111414        if  (value  ==  NULL ) {
14121415            PyErr_Clear ();
@@ -1452,6 +1455,7 @@ _PyFrame_LocalsToFast(_PyInterpreterFrame *frame, int clear)
14521455            }
14531456            Py_XSETREF (fast [i ], Py_NewRef (value ));
14541457        }
1458+         Py_XDECREF (value );
14551459    }
14561460    PyErr_SetRaisedException (exc );
14571461}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments