Returning DISABLE from a sys.monitoring callback for an event >= PY_MONITORING_INSTRUMENTED_EVENTS triggers an assert in a debug build. It would probably be better to just ignore a DISABLE return value since anything else can be returned (I think) or mandate that None be returned. If the current behavior is retained, it should be documented.
I didn't test in a non debug build.
Linked PRs
Returning DISABLE from a sys.monitoring callback for an event >= PY_MONITORING_INSTRUMENTED_EVENTS triggers an assert in a debug build. It would probably be better to just ignore a DISABLE return value since anything else can be returned (I think) or mandate that None be returned. If the current behavior is retained, it should be documented.
I didn't test in a non debug build.
Linked PRs
ValueErrorwhen attempting to disable events that cannot be disabled. #107337ValueErrorwhen attempting to disable events that cannot be disabled. (GH-107337) #107351