Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Doc/c-api/interp-lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ The following functions can be safely called before Python is initialized:

Despite their apparent similarity to some of the functions listed above,
the following functions **should not be called** before the interpreter has
been initialized: :c:func:`Py_EncodeLocale`, :c:func:`PyEval_InitThreads`, and
:c:func:`Py_RunMain`.
been initialized: :c:func:`Py_EncodeLocale`, and :c:func:`Py_RunMain`.


.. _global-conf-vars:
Expand Down Expand Up @@ -355,7 +354,6 @@ Initializing and finalizing the interpreter
.. c:function:: void Py_Initialize()

.. index::
single: PyEval_InitThreads()
single: modules (in module sys)
single: path (in module sys)
pair: module; builtins
Expand Down
27 changes: 0 additions & 27 deletions Doc/c-api/threads.rst
Original file line number Diff line number Diff line change
Expand Up @@ -577,33 +577,6 @@ C extensions.
This thread's interpreter state.


.. c:function:: void PyEval_InitThreads()

.. index::
single: PyEval_AcquireThread()
single: PyEval_ReleaseThread()
single: PyEval_SaveThread()
single: PyEval_RestoreThread()

Deprecated function which does nothing.

In Python 3.6 and older, this function created the GIL if it didn't exist.

.. versionchanged:: 3.9
The function now does nothing.

.. versionchanged:: 3.7
This function is now called by :c:func:`Py_Initialize()`, so you don't
have to call it yourself anymore.

.. versionchanged:: 3.2
This function cannot be called before :c:func:`Py_Initialize()` anymore.

.. deprecated:: 3.9

.. index:: pair: module; _thread


.. c:function:: PyThreadState* PyEval_SaveThread()

Detach the :term:`attached thread state` and return it.
Expand Down
1 change: 0 additions & 1 deletion Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Doc/tools/removed-ids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Remove from here in 3.16
c-api/allocation.html: deprecated-aliases
c-api/file.html: deprecated-api
c-api/threads.html: c.PyEval_InitThreads

# Removed sections
library/asyncio-task.html: terminating-a-task-group
Expand Down
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,10 @@ Deprecated C APIs
Removed C APIs
--------------

* Remove :c:func:`!PyEval_InitThreads` function which did nothing since Python
3.7 and was deprecated since Python 3.9.
(Contributed by Victor Stinner in :gh:`154757`.)

* The :c:var:`!PyUnstable_ExecutableKinds` array, as well as the macros
:c:macro:`!PyUnstable_EXECUTABLE_KIND_SKIP`,
:c:macro:`!PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`,
Expand Down
2 changes: 0 additions & 2 deletions Include/ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(PyFrameObject *f, int exc);
PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void);
PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *);

Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);

PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove :c:func:`!PyEval_InitThreads` function which did nothing since Python
3.7 and was deprecated since Python 3.9. Patch by Victor Stinner.
1 change: 1 addition & 0 deletions Misc/stable_abi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@
added = '3.2'
[function.PyEval_InitThreads]
added = '3.2'
abi_only = true
[function.PyEval_ReleaseLock]
added = '3.2'
abi_only = true
Expand Down
3 changes: 2 additions & 1 deletion Python/ceval_gil.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ _PyEval_FiniGIL(PyInterpreterState *interp)
interp->ceval.gil = NULL;
}

void
// Function removed in Python 3.16 limited C API, but kept in the stable ABI
PyAPI_FUNC(void)
PyEval_InitThreads(void)
{
/* Do nothing: kept for backward compatibility */
Expand Down
Loading