summaryrefslogtreecommitdiffstats
path: root/Lib/opcode.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-05-16 03:36:23 (GMT)
committerGitHub <noreply@github.com>2023-05-16 03:36:23 (GMT)
commit24d8b88420b81fc60aeb0cbcacef1e72d633824a (patch)
tree1b06e157ddc7d1066fd41a28d2c27270ccf2e278 /Lib/opcode.py
parentfdafdc235e74f2f4fedc1f745bf8b90141daa162 (diff)
downloadcpython-24d8b88420b81fc60aeb0cbcacef1e72d633824a.zip
cpython-24d8b88420b81fc60aeb0cbcacef1e72d633824a.tar.gz
cpython-24d8b88420b81fc60aeb0cbcacef1e72d633824a.tar.bz2
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>
Diffstat (limited to 'Lib/opcode.py')
-rw-r--r--Lib/opcode.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/opcode.py b/Lib/opcode.py
index 155466b..97d0a65 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -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": [