GH-104584: Fix incorrect uoperands (GH-107513)
![](https://secure.gravatar.com/avatar/cc7737cd64a84f1b5c61a160798e97ee.jpg?s=120&d=mm&r=g)
https://github.com/python/cpython/commit/5e584eb704d656c9a6a648dadda63237706... commit: 5e584eb704d656c9a6a648dadda63237706287db branch: main author: Brandt Bucher <brandtbucher@microsoft.com> committer: brandtbucher <brandtbucher@gmail.com> date: 2023-07-31T21:16:57Z summary: GH-104584: Fix incorrect uoperands (GH-107513) files: A Misc/NEWS.d/next/Core and Builtins/2023-07-29-22-01-30.gh-issue-104584.tINuoA.rst M 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 index 0000000000000..059524831597b --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-07-29-22-01-30.gh-issue-104584.tINuoA.rst @@ -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. diff --git a/Python/optimizer.c b/Python/optimizer.c index 09120c33d130c..238ab02d09faa 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -579,7 +579,8 @@ translate_bytecode_to_trace( 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)) {
participants (1)
-
brandtbucher