@@ -491,7 +491,7 @@ each key.
491
491
static PyObject *
492
492
dictbytype (PyObject * src , int scope_type , int flag , Py_ssize_t offset )
493
493
{
494
- Py_ssize_t i = offset , scope , num_keys , key_i ;
494
+ Py_ssize_t i = offset , num_keys , key_i ;
495
495
PyObject * k , * v , * dest = PyDict_New ();
496
496
PyObject * sorted_keys ;
497
497
@@ -533,10 +533,7 @@ dictbytype(PyObject *src, int scope_type, int flag, Py_ssize_t offset)
533
533
Py_DECREF (dest );
534
534
return NULL ;
535
535
}
536
- /* XXX this should probably be a macro in symtable.h */
537
- scope = (vi >> SCOPE_OFFSET ) & SCOPE_MASK ;
538
-
539
- if (scope == scope_type || vi & flag ) {
536
+ if (SYMBOL_TO_SCOPE (vi ) == scope_type || vi & flag ) {
540
537
PyObject * item = PyLong_FromSsize_t (i );
541
538
if (item == NULL ) {
542
539
Py_DECREF (sorted_keys );
@@ -5393,7 +5390,7 @@ push_inlined_comprehension_state(struct compiler *c, location loc,
5393
5390
if (symbol == -1 && PyErr_Occurred ()) {
5394
5391
return ERROR ;
5395
5392
}
5396
- long scope = (symbol >> SCOPE_OFFSET ) & SCOPE_MASK ;
5393
+ long scope = SYMBOL_TO_SCOPE (symbol ) ;
5397
5394
PyObject * outv = PyDict_GetItemWithError (SYMTABLE_ENTRY (c )-> ste_symbols , k );
5398
5395
if (outv == NULL ) {
5399
5396
if (PyErr_Occurred ()) {
@@ -5405,7 +5402,7 @@ push_inlined_comprehension_state(struct compiler *c, location loc,
5405
5402
if (outsymbol == -1 && PyErr_Occurred ()) {
5406
5403
return ERROR ;
5407
5404
}
5408
- long outsc = (outsymbol >> SCOPE_OFFSET ) & SCOPE_MASK ;
5405
+ long outsc = SYMBOL_TO_SCOPE (outsymbol ) ;
5409
5406
// If a name has different scope inside than outside the comprehension,
5410
5407
// we need to temporarily handle it with the right scope while
5411
5408
// compiling the comprehension. If it's free in the comprehension
0 commit comments