Skip to content

Commit 2e19855

Browse files
[3.13] gh-151524: Make it clearer that _PyInstrumentation_DISABLE is immortal in the code (GH-151525) (GH-155351)
(cherry picked from commit 52bed26) Co-authored-by: stevens <lipengyu@kylinos.cn>
1 parent d8c20a5 commit 2e19855

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Python/instrumentation.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,12 @@ call_one_instrument(
960960
if (res == NULL) {
961961
return -1;
962962
}
963+
if (res == &_PyInstrumentation_DISABLE) {
964+
assert(_Py_IsImmortal(res));
965+
return 1;
966+
}
963967
Py_DECREF(res);
964-
return (res == &_PyInstrumentation_DISABLE);
968+
return 0;
965969
}
966970

967971
static const int8_t MOST_SIGNIFICANT_BITS[16] = {

0 commit comments

Comments
 (0)