Le ven. 3 juil. 2020 à 04:51, Inada Naoki
Actually, PyEval_ReleaseLock is used in three packages:
pydevd-pycharm-202.5103.19/pydevd_attach_to_process/windows/attach.cpp 330: DEFINE_PROC(releaseLock, PyEval_Lock*, "PyEval_ReleaseLock", -160);
jep-3.9.0/src/main/c/Jep/pyembed.c 836: PyEval_ReleaseLock();
ptvsd-4.3.2.zip/ptvsd-4.3.2/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/windows/attach.cpp 330: DEFINE_PROC(releaseLock, PyEval_Lock*, "PyEval_ReleaseLock", -160);
I will keep PyEval_ReleaseLock.
The PEP 620 doesn't require to keep a deprecated forever: only to notify projects that the function is going to be removed, and try to help them to replace it. pydevd-pycharm
I think they use only PyEval_ReleaseLock(). Do they use PyEval_AcquireLock() too?
I checked with GitHub code search on the JEP project: PyEval_AcquireLock() is not used. PyEval_ReleaseLock() is called in a single function: https://github.com/ninia/jep/blob/639f6cbe512b5ce4b51412564dba8db5bbbf1e3b/s... Also, I'm not sure that JEP uses PyEval_ReleaseLock() properly: https://github.com/ninia/jep/issues/229#issuecomment-635467616 I don't see why a lock would hold the GIL but release it before exiting. Maybe JEP should call PyThreadState_DeleteCurrent(), which calls PyEval_ReleaseLock() internally, in pyembed_thread_close(). The _thread.start_new_thread() calls _PyThreadState_DeleteCurrent(tstate) when a thread completes, and this function calls _PyEval_ReleaseLock(tstate). Maybe PyEval_ReleaseLock() documentation should explain that. Victor -- Night gathers, and now my watch begins. It shall not end until my death.