Skip to content

Commit 48c2d37

Browse files
lpyu001miss-islington
authored andcommitted
gh-151524: Make it clearer that _PyInstrumentation_DISABLE is immortal in the code (GH-151525)
(cherry picked from commit 52bed26) Co-authored-by: stevens <lipengyu@kylinos.cn>
1 parent 70df291 commit 48c2d37

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
@@ -989,8 +989,12 @@ call_one_instrument(
989989
if (res == NULL) {
990990
return -1;
991991
}
992+
if (res == &_PyInstrumentation_DISABLE) {
993+
assert(_Py_IsImmortal(res));
994+
return 1;
995+
}
992996
Py_DECREF(res);
993-
return (res == &_PyInstrumentation_DISABLE);
997+
return 0;
994998
}
995999

9961000
static const int8_t MOST_SIGNIFICANT_BITS[16] = {

0 commit comments

Comments
 (0)