https://github.com/python/cpython/commit/2e19855a1734a47780b42cfcdc9e3f31976c3e7c
commit: 2e19855a1734a47780b42cfcdc9e3f31976c3e7c
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-08-07T15:52:49Z
summary:

[3.13] gh-151524: Make it clearer that `_PyInstrumentation_DISABLE` is immortal 
in the code (GH-151525) (GH-155351)

(cherry picked from commit 52bed26b79cc0333f1b26fd144488e4b38ebd0b5)

Co-authored-by: stevens <[email protected]>

files:
M Python/instrumentation.c

diff --git a/Python/instrumentation.c b/Python/instrumentation.c
index 21d9692b586163e..917a815eb951a06 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -960,8 +960,12 @@ call_one_instrument(
     if (res == NULL) {
         return -1;
     }
+    if (res == &_PyInstrumentation_DISABLE) {
+        assert(_Py_IsImmortal(res));
+        return 1;
+    }
     Py_DECREF(res);
-    return (res == &_PyInstrumentation_DISABLE);
+    return 0;
 }
 
 static const int8_t MOST_SIGNIFICANT_BITS[16] = {

_______________________________________________
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