[Python-checkins] bpo-45711: Re-bump the magic number and update doc (GH-29528)

iritkatriel webhook-mailer at python.org
Fri Nov 12 08:21:54 EST 2021

commit: 8f1b71de731dda668aede7c9b34d0ad7afb8f6a8
branch: main
author: Brandt Bucher <brandt at python.org>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2021-11-12T13:21:45Z

bpo-45711: Re-bump the magic number and update doc (GH-29528)

M Doc/library/dis.rst
M Doc/whatsnew/3.11.rst
M Lib/importlib/_bootstrap_external.py

diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 4a804044df000..5fe9f65f46a71 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -873,10 +873,13 @@ All of the following opcodes use their arguments.
 .. opcode:: JUMP_IF_NOT_EXC_MATCH (target)
    Tests whether the second value on the stack is an exception matching TOS,
-   and jumps if it is not. Pops two values from the stack.
+   and jumps if it is not. Pops one value from the stack.
    .. versionadded:: 3.9
+   .. versionchanged:: 3.11
+      This opcode no longer pops the active exception.
 .. opcode:: JUMP_IF_TRUE_OR_POP (target)
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 59a230f26ab42..0767a6a03ac2a 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -332,6 +332,8 @@ CPython bytecode changes
 * Added :opcode:`COPY`, which pushes the *i*-th item to the top of the stack.
   The item is not removed from its original location.
+* :opcode:`JUMP_IF_NOT_EXC_MATCH` no longer pops the active exception.
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index f6f54af68488f..303ca728ec892 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -366,7 +366,10 @@ def _write_atomic(path, data, mode=0o666):
 #     Python 3.11a1 3461 (JUMP_ABSOLUTE must jump backwards)
 #     Python 3.11a2 3462 (bpo-44511: remove COPY_DICT_WITHOUT_KEYS, change
 #                         MATCH_CLASS and MATCH_KEYS, and add COPY)
-#     Python 3.11a3 3463 (Merge numeric BINARY_*/INPLACE_* into BINARY_OP)
+#     Python 3.11a3 3463 (bpo-45711: JUMP_IF_NOT_EXC_MATCH no longer pops the
+#                         active exception)
+#     Python 3.11a3 3464 (bpo-45636: Merge numeric BINARY_*/INPLACE_* into
+#                         BINARY_OP)
 # MAGIC must change whenever the bytecode emitted by the compiler may no
@@ -376,7 +379,7 @@ def _write_atomic(path, data, mode=0o666):
 # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
 # in PC/launcher.c must also be updated.
-MAGIC_NUMBER = (3463).to_bytes(2, 'little') + b'\r\n'
+MAGIC_NUMBER = (3464).to_bytes(2, 'little') + b'\r\n'
 _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little')  # For import.c
 _PYCACHE = '__pycache__'

More information about the Python-checkins mailing list