mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-120029: export DEF_TYPE_PARAM
compiler flag (#120028)
This commit is contained in:
parent
e69d068ad0
commit
ff1857d6ed
5 changed files with 24 additions and 5 deletions
|
@ -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.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue