[New-bugs-announce] [issue36728] Remove PyEval_ReInitThreads() from the public C API

STINNER Victor report at bugs.python.org
Thu Apr 25 19:22:09 EDT 2019


New submission from STINNER Victor <vstinner at redhat.com>:

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()

	assert.True(t, PyEval_ThreadsInitialized())

	PyEval_ReInitThreads()
}

I don't think that the PyEval_ReInitThreads() call here makes any sense.

----------
components: Interpreter Core
messages: 340868
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove PyEval_ReInitThreads() from the public C API
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36728>
_______________________________________


More information about the New-bugs-announce mailing list