summaryrefslogtreecommitdiffstats
path: root/Python/opcode_metadata.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-02-08 01:35:55 (GMT)
committerGitHub <noreply@github.com>2023-02-08 01:35:55 (GMT)
commitb2b85b5db9cfdb24f966b61757536a898abc3830 (patch)
treeb5f09e352132a15f5e782e75ce6205b3da0552b1 /Python/opcode_metadata.h
parentaacbdb0c650492756738b044e6ddf8b72f89a1a2 (diff)
downloadcpython-b2b85b5db9cfdb24f966b61757536a898abc3830.zip
cpython-b2b85b5db9cfdb24f966b61757536a898abc3830.tar.gz
cpython-b2b85b5db9cfdb24f966b61757536a898abc3830.tar.bz2
gh-98831: Modernize FORMAT_VALUE (#101628)
Generator update: support balanced parentheses and brackets in conditions and size expressions.
Diffstat (limited to 'Python/opcode_metadata.h')
-rw-r--r--Python/opcode_metadata.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index c1e12a4..52bab1c 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -333,7 +333,7 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
case BUILD_SLICE:
return ((oparg == 3) ? 1 : 0) + 2;
case FORMAT_VALUE:
- return -1;
+ return (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0) + 1;
case COPY:
return (oparg-1) + 1;
case BINARY_OP:
@@ -681,7 +681,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
case BUILD_SLICE:
return 1;
case FORMAT_VALUE:
- return -1;
+ return 1;
case COPY:
return (oparg-1) + 2;
case BINARY_OP: