]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-104584: Fix incorrect uoperands (GH-107513)
authorBrandt Bucher <brandtbucher@microsoft.com>
Mon, 31 Jul 2023 21:16:57 +0000 (14:16 -0700)
committerGitHub <noreply@github.com>
Mon, 31 Jul 2023 21:16:57 +0000 (21:16 +0000)
Misc/NEWS.d/next/Core and Builtins/2023-07-29-22-01-30.gh-issue-104584.tINuoA.rst [new file with mode: 0644]
Python/optimizer.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-07-29-22-01-30.gh-issue-104584.tINuoA.rst b/Misc/NEWS.d/next/Core and Builtins/2023-07-29-22-01-30.gh-issue-104584.tINuoA.rst
new file mode 100644 (file)
index 0000000..0595248
--- /dev/null
@@ -0,0 +1,2 @@
+Fix an issue which caused incorrect inline caches to be read when running
+with :envvar:`PYTHONUOPS` or :option:`-X uops <-X>` enabled.
index 09120c33d130cae6c03a8a20015f9229e5e8305e..238ab02d09faa79e81ca830f0f1285828c99496b 100644 (file)
@@ -579,7 +579,8 @@ pop_jump_if_bool:
                     for (int i = 0; i < nuops; i++) {
                         oparg = orig_oparg;
                         uint64_t operand = 0;
-                        int offset = expansion->uops[i].offset;
+                        // Add one to account for the actual opcode/oparg pair:
+                        int offset = expansion->uops[i].offset + 1;
                         switch (expansion->uops[i].size) {
                             case OPARG_FULL:
                                 if (extras && OPCODE_HAS_JUMP(opcode)) {