https://github.com/python/cpython/commit/182aea2f57002dcea39dfdfe3faf642d724dd80b
commit: 182aea2f57002dcea39dfdfe3faf642d724dd80b
branch: main
author: Ken Jin <[email protected]>
committer: markshannon <[email protected]>
date: 2026-03-16T13:52:56Z
summary:

gh-146018: Disable over-aggressive optimization for _GUARD_CODE_VERSION 
(GH-145923)

files:
M Python/optimizer_bytecodes.c
M Python/optimizer_cases.c.h

diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index e0410be55652b4..f3a391b2e37ef9 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -1761,7 +1761,9 @@ dummy_func(void) {
         PyCodeObject *co = get_current_code_object(ctx);
         if (co->co_version == version) {
             _Py_BloomFilter_Add(dependencies, co);
-            REPLACE_OP(this_instr, _NOP, 0, 0);
+            // TODO gh-144651:
+            // If we've previously guarded on this code version in a trace, we
+            // can avoid guarding it again.
         }
         else {
             ctx->done = true;
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h
index 7e5b26c6d725d6..942a730e4faccf 100644
--- a/Python/optimizer_cases.c.h
+++ b/Python/optimizer_cases.c.h
@@ -4290,7 +4290,6 @@
             PyCodeObject *co = get_current_code_object(ctx);
             if (co->co_version == version) {
                 _Py_BloomFilter_Add(dependencies, co);
-                REPLACE_OP(this_instr, _NOP, 0, 0);
             }
             else {
                 ctx->done = true;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to