summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorpenguin_wwy <940375606@qq.com>2022-01-06 11:38:35 (GMT)
committerGitHub <noreply@github.com>2022-01-06 11:38:35 (GMT)
commit3db762db72cc0da938614b1e414abb1e12ca4094 (patch)
treeeef08b55d931522d2f83ed7b6f2383d27d8a4ffe /Lib
parent35d6540c904ef07b8602ff014e520603f84b5886 (diff)
downloadcpython-3db762db72cc0da938614b1e414abb1e12ca4094.zip
cpython-3db762db72cc0da938614b1e414abb1e12ca4094.tar.gz
cpython-3db762db72cc0da938614b1e414abb1e12ca4094.tar.bz2
bpo-46031: add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE (GH-30019)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_bootstrap_external.py3
-rw-r--r--Lib/opcode.py4
2 files changed, 4 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 872d6d9..8e21be5 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -378,6 +378,7 @@ _code_type = type(_write_atomic.__code__)
# Python 3.11a4 3470 (bpo-46221: PREP_RERAISE_STAR no longer pushes lasti)
# Python 3.11a4 3471 (bpo-46202: remove pop POP_EXCEPT_AND_RERAISE)
# Python 3.11a4 3472 (bpo-46009: replace GEN_START with POP_TOP)
+# Python 3.11a4 3473 (Add POP_JUMP_IF_NOT_NONE/POP_JUMP_IF_NONE opcodes)
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
@@ -387,7 +388,7 @@ _code_type = type(_write_atomic.__code__)
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.
-MAGIC_NUMBER = (3472).to_bytes(2, 'little') + b'\r\n'
+MAGIC_NUMBER = (3473).to_bytes(2, 'little') + b'\r\n'
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
_PYCACHE = '__pycache__'
diff --git a/Lib/opcode.py b/Lib/opcode.py
index f99e20a..6030743 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -148,9 +148,9 @@ def_op('STORE_FAST', 125) # Local variable number
haslocal.append(125)
def_op('DELETE_FAST', 126) # Local variable number
haslocal.append(126)
-
jabs_op('JUMP_IF_NOT_EG_MATCH', 127)
-
+jabs_op('POP_JUMP_IF_NOT_NONE', 128)
+jabs_op('POP_JUMP_IF_NONE', 129)
def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3)
def_op('MAKE_FUNCTION', 132) # Flags