gh-120029: export DEF_TYPE_PARAM compiler flag (#120028)

This commit is contained in:
Bénédikt Tran 2024-06-04 16:24:22 +02:00 committed by GitHub
parent e69d068ad0
commit ff1857d6ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 5 deletions

View file

@ -1,9 +1,13 @@
"""Interface to the compiler's internal symbol tables"""
import _symtable
from _symtable import (USE, DEF_GLOBAL, DEF_NONLOCAL, DEF_LOCAL, DEF_PARAM,
DEF_IMPORT, DEF_BOUND, DEF_ANNOT, SCOPE_OFF, SCOPE_MASK, FREE,
LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL)
from _symtable import (
USE,
DEF_GLOBAL, DEF_NONLOCAL, DEF_LOCAL,
DEF_PARAM, DEF_TYPE_PARAM, DEF_IMPORT, DEF_BOUND, DEF_ANNOT,
SCOPE_OFF, SCOPE_MASK,
FREE, LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL
)
import weakref
@ -253,13 +257,18 @@ class Symbol:
"""Return *True* if the symbol is used in
its block.
"""
return bool(self.__flags & _symtable.USE)
return bool(self.__flags & USE)
def is_parameter(self):
"""Return *True* if the symbol is a parameter.
"""
return bool(self.__flags & DEF_PARAM)
def is_type_parameter(self):
"""Return *True* if the symbol is a type parameter.
"""
return bool(self.__flags & DEF_TYPE_PARAM)
def is_global(self):
"""Return *True* if the symbol is global.
"""