Le 12/08/2020 à 10:40, Sebastian Berg a écrit :
Thanks, can't say I can make much of it after looking at it for a while. It currently seems to me that using PyGILState_Ensure is likely fine on the same thread which released the GIL (or can be made to work in Python). But it also seems to that passing in the threadstate is probably just cleaner/nicer when possible.
A threadstate is supposed to be associated to a particuler OS thread. For example, the threadstate is destroyed (and its pointer deallocated) when the OS thread exits.
So, no, passing the threadstate is not how you should do it.
Antoine mentioned passing
PyInterpreterState *
, so I am unsure if there would be a reason to prefer that?If there is no clear right thing, but passing something seems preferred, I can also just pass:
void *reserved = NULL
for now to simplify eventual addition.
That sounds reasonable.
Regards
Antoine.