<mattip>
the functions HPy_ReenterPythonExecution and HPy_LeavePythonExecution need to accept/return a HPyThreadState, which wraps a PyThreadState*
<mattip>
and the static inline functions _threads2h and _h2threads convert a handle to a PyThreadState
<mattip>
on PyPy this requires cpyext
<mattip>
was there any thought given to not tying the GIL handling together with the C-specific thread state struct, which is hard to replicate in cpyext?
<mattip>
there are still open issues about PyPy's PyThreadState status, it would be nice to deprecate access to that info from C and require some python code eval to access the info
<mattip>
in the meantime, I am implementing _h2threads as a stub function that raises NotImplementedError
FFY00_ has joined #hpy
FFY00 has quit [Read error: Connection reset by peer]
<antocuni>
mattip: I think you are confused
<antocuni>
from the HPy point of view, HPyThreadState is completely opaque: it's just a struct which contains an intptr_t
<antocuni>
so in the PyPy implementation of HPy, we can choose to return whatever we want (probably a handle pointing to the result of state.get_thread_state())
<antocuni>
the _threads2h and _h2threads that you are seeing are in the *cpython implementation of hpy*
<antocuni>
so they are an implementation detail that has nothing to do with pypy
<antocuni>
the layout of directories in the hpy repo is a big confusing, I admit
<antocuni>
hpy/devel/include/hpy/universal/ contains the public API/ABI for universal extensions, and thus are relevant for PyPy
<antocuni>
hpy/universal/* contains the the *CPython* implementation of hpy, so they are completely irrelevant for PyPy, GraalPy, etc.
<antocuni>
maybe we should rename hpy/universal into hpy/cpy_universal
<antocuni>
even more confusing, the cpython implementation of hpy is split into two different places:
<antocuni>
hpy/universal/src and hpy/devel/include/hpy/cpython
<antocuni>
because we have actually TWO implementations of HPy on CPython: the one which compiles HPy extension to the CPython ABI and the one which implement the HPy universal ABI on top of CPython; and some files are shared between the two, some are not
<antocuni>
I hope I have clarified a bit instead of making things even more confusing :)