@@ -1359,16 +1359,22 @@ symtable_enter_block(struct symtable *st, identifier name, _Py_block_ty block,
13591359}
13601360
13611361static long
1362- symtable_lookup (struct symtable * st , PyObject * name )
1362+ symtable_lookup_entry (struct symtable * st , PySTEntryObject * ste , PyObject * name )
13631363{
13641364 PyObject * mangled = _Py_Mangle (st -> st_private , name );
13651365 if (!mangled )
13661366 return 0 ;
1367- long ret = _PyST_GetSymbol (st -> st_cur , mangled );
1367+ long ret = _PyST_GetSymbol (ste , mangled );
13681368 Py_DECREF (mangled );
13691369 return ret ;
13701370}
13711371
1372+ static long
1373+ symtable_lookup (struct symtable * st , PyObject * name )
1374+ {
1375+ return symtable_lookup_entry (st , st -> st_cur , name );
1376+ }
1377+
13721378static int
13731379symtable_add_def_helper (struct symtable * st , PyObject * name , int flag , struct _symtable_entry * ste ,
13741380 int lineno , int col_offset , int end_lineno , int end_col_offset )
@@ -2009,7 +2015,7 @@ symtable_extend_namedexpr_scope(struct symtable *st, expr_ty e)
20092015 * binding conflict with iteration variables, otherwise skip it
20102016 */
20112017 if (ste -> ste_comprehension ) {
2012- long target_in_scope = _PyST_GetSymbol ( ste , target_name );
2018+ long target_in_scope = symtable_lookup_entry ( st , ste , target_name );
20132019 if ((target_in_scope & DEF_COMP_ITER ) &&
20142020 (target_in_scope & DEF_LOCAL )) {
20152021 PyErr_Format (PyExc_SyntaxError , NAMED_EXPR_COMP_CONFLICT , target_name );
@@ -2025,7 +2031,7 @@ symtable_extend_namedexpr_scope(struct symtable *st, expr_ty e)
20252031
20262032 /* If we find a FunctionBlock entry, add as GLOBAL/LOCAL or NONLOCAL/LOCAL */
20272033 if (ste -> ste_type == FunctionBlock ) {
2028- long target_in_scope = _PyST_GetSymbol ( ste , target_name );
2034+ long target_in_scope = symtable_lookup_entry ( st , ste , target_name );
20292035 if (target_in_scope & DEF_GLOBAL ) {
20302036 if (!symtable_add_def (st , target_name , DEF_GLOBAL , LOCATION (e )))
20312037 VISIT_QUIT (st , 0 );
0 commit comments