Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Description
Following the recent discussion aboutrestrictions totp_traverse handlers.
In#131264 (comment)@colesbury noted that
PyThreadState_GetUnchecked() != NULLseems like a sufficient way to decide if it's safe to call into the interpreter.
I have previously observed thatPyThreadState_GetUnchecked will return non-null when inside atp_traverse handler. Should it be changed to returnNULL so that@colesbury 's statement remains valid insidetp_traverse handlers too?
If no, I have ways I can workaround in PyO3. But I worry about edge cases like a signal handler being hit inside oftp_traverse, maybe in that case code will need to check whether it is attached to the interpreter (withPyThreadStateGetUnchecked?) and then if not, safely fail to attach until the traverse has finished.