David Edelsohn <dje....@gmail.com> added the comment:
It seems that PyOS_AfterFork_Child() needs to do something like PyThreadState *tstate = PyThreadState_Get(); PyObject *wr = _PyObject_CAST(tstate->on_delete_data); PyObject *obj = PyWeakref_GET_OBJECT(wr); lockobject *lock; if (obj != Py_None) { lock = (lockobject *) obj; if (lock->locked) { /* Leak memory on purpose. */ lock->locked = 0; } } before the call to _PyEval_ReInitThreads. Maybe encapsulate that as PyThread_ReInitThreads(). The locks in the threads in the child need to be cleared before _PyThreadState_DeleteExcept() so that Python does not try to release the locks in the child. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40092> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com