https://github.com/python/cpython/commit/a8a3b24c139ac132a1d75ca22dbc7cb10ad962d2 commit: a8a3b24c139ac132a1d75ca22dbc7cb10ad962d2 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2026-08-08T04:20:33Z summary:
[3.15] gh-151524: Make it clearer that `_PyInstrumentation_DISABLE` is immortal in the code (GH-151525) (#155350) gh-151524: Make it clearer that `_PyInstrumentation_DISABLE` is immortal in the code (GH-151525) (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 51bcbfdb3b6c55b..646fc15c6872e56 100644 --- a/Python/instrumentation.c +++ b/Python/instrumentation.c @@ -989,8 +989,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]
