mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-103763: Implement PEP 695 (#103764)
This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
fdafdc235e
commit
24d8b88420
56 changed files with 11405 additions and 5469 deletions
|
|
@ -131,6 +131,7 @@ def_op('RETURN_GENERATOR', 75)
|
|||
def_op('RETURN_VALUE', 83)
|
||||
|
||||
def_op('SETUP_ANNOTATIONS', 85)
|
||||
def_op('LOAD_LOCALS', 87)
|
||||
|
||||
def_op('POP_EXCEPT', 89)
|
||||
|
||||
|
|
@ -206,7 +207,6 @@ EXTENDED_ARG = 144
|
|||
def_op('LIST_APPEND', 145)
|
||||
def_op('SET_ADD', 146)
|
||||
def_op('MAP_ADD', 147)
|
||||
def_op('LOAD_CLASSDEREF', 148)
|
||||
hasfree.append(148)
|
||||
def_op('COPY_FREE_VARS', 149)
|
||||
def_op('YIELD_VALUE', 150)
|
||||
|
|
@ -228,6 +228,10 @@ hasconst.append(172)
|
|||
def_op('CALL_INTRINSIC_1', 173)
|
||||
def_op('CALL_INTRINSIC_2', 174)
|
||||
|
||||
name_op('LOAD_FROM_DICT_OR_GLOBALS', 175)
|
||||
def_op('LOAD_FROM_DICT_OR_DEREF', 176)
|
||||
hasfree.append(176)
|
||||
|
||||
# Instrumented instructions
|
||||
MIN_INSTRUMENTED_OPCODE = 238
|
||||
|
||||
|
|
@ -318,12 +322,20 @@ _intrinsic_1_descs = [
|
|||
"INTRINSIC_ASYNC_GEN_WRAP",
|
||||
"INTRINSIC_UNARY_POSITIVE",
|
||||
"INTRINSIC_LIST_TO_TUPLE",
|
||||
"INTRINSIC_TYPEVAR",
|
||||
"INTRINSIC_PARAMSPEC",
|
||||
"INTRINSIC_TYPEVARTUPLE",
|
||||
"INTRINSIC_SUBSCRIPT_GENERIC",
|
||||
"INTRINSIC_TYPEALIAS",
|
||||
]
|
||||
|
||||
_intrinsic_2_descs = [
|
||||
'INTRINSIC_2_INVALID',
|
||||
'INTRINSIC_PREP_RERAISE_STAR',
|
||||
]
|
||||
"INTRINSIC_2_INVALID",
|
||||
"INTRINSIC_PREP_RERAISE_STAR",
|
||||
"INTRINSIC_TYPEVAR_WITH_BOUND",
|
||||
"INTRINSIC_TYPEVAR_WITH_CONSTRAINTS",
|
||||
"INTRINSIC_SET_FUNCTION_TYPE_PARAMS",
|
||||
]
|
||||
|
||||
_specializations = {
|
||||
"BINARY_OP": [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue