summaryrefslogtreecommitdiffstats
path: root/Python/opcode_metadata.h
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 /Python/opcode_metadata.h
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 'Python/opcode_metadata.h')
-rw-r--r--Python/opcode_metadata.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index ae68e04..601ad38 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -161,8 +161,12 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
return 1;
case DELETE_GLOBAL:
return 0;
- case LOAD_NAME:
+ case LOAD_LOCALS:
return 0;
+ case LOAD_NAME:
+ return 0+1;
+ case LOAD_FROM_DICT_OR_GLOBALS:
+ return 1;
case LOAD_GLOBAL:
return 0;
case LOAD_GLOBAL_MODULE:
@@ -175,8 +179,8 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
return 0;
case DELETE_DEREF:
return 0;
- case LOAD_CLASSDEREF:
- return 0;
+ case LOAD_FROM_DICT_OR_DEREF:
+ return 1;
case LOAD_DEREF:
return 0;
case STORE_DEREF:
@@ -551,7 +555,11 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
return 0;
case DELETE_GLOBAL:
return 0;
+ case LOAD_LOCALS:
+ return 1;
case LOAD_NAME:
+ return 1+1;
+ case LOAD_FROM_DICT_OR_GLOBALS:
return 1;
case LOAD_GLOBAL:
return ((oparg & 1) ? 1 : 0) + 1;
@@ -565,7 +573,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
return 0;
case DELETE_DEREF:
return 0;
- case LOAD_CLASSDEREF:
+ case LOAD_FROM_DICT_OR_DEREF:
return 1;
case LOAD_DEREF:
return 1;
@@ -869,14 +877,16 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = {
[DELETE_ATTR] = { true, INSTR_FMT_IB },
[STORE_GLOBAL] = { true, INSTR_FMT_IB },
[DELETE_GLOBAL] = { true, INSTR_FMT_IB },
+ [LOAD_LOCALS] = { true, INSTR_FMT_IB },
[LOAD_NAME] = { true, INSTR_FMT_IB },
+ [LOAD_FROM_DICT_OR_GLOBALS] = { true, INSTR_FMT_IB },
[LOAD_GLOBAL] = { true, INSTR_FMT_IBC000 },
[LOAD_GLOBAL_MODULE] = { true, INSTR_FMT_IBC000 },
[LOAD_GLOBAL_BUILTIN] = { true, INSTR_FMT_IBC000 },
[DELETE_FAST] = { true, INSTR_FMT_IB },
[MAKE_CELL] = { true, INSTR_FMT_IB },
[DELETE_DEREF] = { true, INSTR_FMT_IB },
- [LOAD_CLASSDEREF] = { true, INSTR_FMT_IB },
+ [LOAD_FROM_DICT_OR_DEREF] = { true, INSTR_FMT_IB },
[LOAD_DEREF] = { true, INSTR_FMT_IB },
[STORE_DEREF] = { true, INSTR_FMT_IB },
[COPY_FREE_VARS] = { true, INSTR_FMT_IB },