]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-146018: Disable over-aggressive optimization for _GUARD_CODE_VERSION (GH-145923)
authorKen Jin <kenjin@python.org>
Mon, 16 Mar 2026 13:52:56 +0000 (21:52 +0800)
committerGitHub <noreply@github.com>
Mon, 16 Mar 2026 13:52:56 +0000 (13:52 +0000)
Python/optimizer_bytecodes.c
Python/optimizer_cases.c.h

index e0410be55652b4cb0a5be4512834286b77df73f4..f3a391b2e37ef98f9f6087a89779ac12cde4cd14 100644 (file)
@@ -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;
index 7e5b26c6d725d688e9deed02d42531be739c36b8..942a730e4faccfc656080d1b8b3101aaa2155608 100644 (file)
             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;