gh-122985: add SYMBOL_TO_SCOPE macro in symtable (#122986)

This commit is contained in:
Irit Katriel 2024-08-14 06:17:04 +01:00 committed by GitHub
parent e03073ff20
commit 05fc4d758a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 9 deletions

View file

@ -551,7 +551,7 @@ _PyST_GetScope(PySTEntryObject *ste, PyObject *name)
if (symbol < 0) {
return -1;
}
return (symbol >> SCOPE_OFFSET) & SCOPE_MASK;
return SYMBOL_TO_SCOPE(symbol);
}
int
@ -809,7 +809,7 @@ inline_comprehension(PySTEntryObject *ste, PySTEntryObject *comp,
assert(_PyUnicode_EqualToASCIIString(k, ".0"));
continue;
}
int scope = (comp_flags >> SCOPE_OFFSET) & SCOPE_MASK;
int scope = SYMBOL_TO_SCOPE(comp_flags);
int only_flags = comp_flags & ((1 << SCOPE_OFFSET) - 1);
if (scope == CELL || only_flags & DEF_COMP_CELL) {
if (PySet_Add(inlined_cells, k) < 0) {