At line 992-993, Py_DECREF(res) then res compared to &_PyInstrumentation_DISABLE. Using a potentially-freed pointer in comparison is UB per C standard.
Compare before DECREF: int is_disable = (res == &_PyInstrumentation_DISABLE); Py_DECREF(res); return is_disable;