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
Remove PyEval_ReInitThreads() from the public C API #80909
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-05-13.10:35:55.872>created_at=<Date2019-04-25.23:22:09.307>labels= ['interpreter-core', '3.8']
title='Remove PyEval_ReInitThreads() from the public C API'updated_at=<Date2019-05-13.14:22:56.780>user='https://github.com/vstinner'
PyEval_ReInitThreads() is used internally by PyOS_AfterFork_Child(). I don't see the point of calling it directly. If you care of threads after fork, just call PyOS_AfterFork_Child(), no?
I propose to remove PyEval_ReInitThreads() from the public C API.
commit fee3a2d
Author: Guido van Rossum <guido@python.org>
Date: Sun Aug 27 17:34:07 2000 +0000
Charles Waldman's patch to reinitialize the interpreter lock after a
fork. This solves the test_fork1 problem. (ceval.c, signalmodule.c,
intrcheck.c)
SourceForge: [ Patch bpo-101226 ] make threading fork-safe
fwiw - i agree that this can be removed. it has no reason to ever be called directly. i double checked in our massive internal codebase at work and found no calls other than python interpreters themselves.
Activity
vstinner commentedon Apr 25, 2019
PyEval_ReInitThreads() is used internally by PyOS_AfterFork_Child(). I don't see the point of calling it directly. If you care of threads after fork, just call PyOS_AfterFork_Child(), no?
I propose to remove PyEval_ReInitThreads() from the public C API.
Problem: it's documented as a public function in High-level API of the Python Initialization API:
https://docs.python.org/dev/c-api/init.html#c.PyEval_ReInitThreads
On the Internet, I found a single project calling directly this function, but it's only in a test used to the test Python threading API:
https://github.com/DataDog/go-python3/blob/master/thread_test.go
func TestThreadInitialization(t *testing.T) {
Py_Initialize()
PyEval_InitThreads()
I don't think that the PyEval_ReInitThreads() call here makes any sense.
vstinner commentedon May 11, 2019
The function was added 19 years ago:
commit fee3a2d
Author: Guido van Rossum <guido@python.org>
Date: Sun Aug 27 17:34:07 2000 +0000
gpshead commentedon May 13, 2019
fwiw - i agree that this can be removed. it has no reason to ever be called directly. i double checked in our massive internal codebase at work and found no calls other than python interpreters themselves.
vstinner commentedon May 13, 2019
Thanks. It confirms what I understood using GitHub code search (see my initial message).
vstinner commentedon May 13, 2019
New changeset d5d9e81 by Victor Stinner in branch 'master':
bpo-36728: Remove PyEval_ReInitThreads() from C API (GH-13241)
d5d9e81
vstinner commentedon May 13, 2019
New changeset c1f7262 by Victor Stinner in branch 'master':
bpo-36728: Remove PyEval_ReInitThreads documentation (GH-13282)
c1f7262