Skip to content

Commit 87bacf1

Browse files
[3.14] gh-151524: Make it clearer that _PyInstrumentation_DISABLE is immortal in the code (GH-151525) (GH-155349)
(cherry picked from commit 52bed26) Co-authored-by: stevens <lipengyu@kylinos.cn>
1 parent 4efa94a commit 87bacf1

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
@@ -988,8 +988,12 @@ call_one_instrument(
988988
if (res == NULL) {
989989
return -1;
990990
}
991+
if (res == &_PyInstrumentation_DISABLE) {
992+
assert(_Py_IsImmortal(res));
993+
return 1;
994+
}
991995
Py_DECREF(res);
992-
return (res == &_PyInstrumentation_DISABLE);
996+
return 0;
993997
}
994998

995999
static const int8_t MOST_SIGNIFICANT_BITS[16] = {

0 commit comments

Comments
 (0)