You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C API] PyOS_ReadlineFunctionPointer API rely on private _PyOS_ReadlineTState variable removed in Python 3.13 #112446
I removed the _PyOS_ReadlineTState variable from the public C API (it was moved to the internal C API). The gdb project sets its readline callback and uses the _PyOS_ReadlineTState variable and so fails to build on Python 3.13.0 alpha2: https://bugzilla.redhat.com/show_bug.cgi?id=2250652
Well, if a readline callback needs to use the Python C API, PyGILState_Ensure() and PyGILState_Release() to be used to temporarily acquire/release the GIL. I'm not sure of the advantage of using PyEval_RestoreThread (_PyOS_ReadlineTState) and PyEval_SaveThread() instead.
Activity
vstinner commentedon Dec 8, 2023
The documentation https://docs.python.org/dev/c-api/veryhigh.html#c.PyOS_ReadlineFunctionPointer should also mention the internal lock, at least explain that the callback cannot be called twice at the same time in two threads.
vstinner commentedon Dec 12, 2023
Well, if a readline callback needs to use the Python C API,
PyGILState_Ensure()andPyGILState_Release()to be used to temporarily acquire/release the GIL. I'm not sure of the advantage of usingPyEval_RestoreThread (_PyOS_ReadlineTState)andPyEval_SaveThread()instead.