https://github.com/python/cpython/commit/87bacf1b49a96cc0e143cd7df813330a8ed9d54c
commit: 87bacf1b49a96cc0e143cd7df813330a8ed9d54c
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-08-07T16:01:26Z
summary:

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

(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 d06cda7c589c74b..0a7400c26993b32 100644
--- a/Python/instrumentation.c
+++ b/Python/instrumentation.c
@@ -988,8 +988,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