bpo-36728: Remove PyEval_ReInitThreads() from C API (GH-13241)
Remove the PyEval_ReInitThreads() function from the Python C API. It should not be called explicitly: use PyOS_AfterFork_Child() instead. Rename PyEval_ReInitThreads() to _PyEval_ReInitThreads() and add a 'runtime' parameter.
This commit is contained in:
parent
3aef48e315
commit
d5d9e81ce9
@ -990,6 +990,11 @@ Changes in the Python API
|
|||||||
Changes in the C API
|
Changes in the C API
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
* The :c:func:`PyEval_ReInitThreads` function has been removed from the C API.
|
||||||
|
It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child`
|
||||||
|
instead.
|
||||||
|
(Contributed by Victor Stinner in :issue:`36728`.)
|
||||||
|
|
||||||
* On Unix, C extensions are no longer linked to libpython except on
|
* On Unix, C extensions are no longer linked to libpython except on
|
||||||
Android. When Python is embedded, ``libpython`` must not be loaded with
|
Android. When Python is embedded, ``libpython`` must not be loaded with
|
||||||
``RTLD_LOCAL``, but ``RTLD_GLOBAL`` instead. Previously, using
|
``RTLD_LOCAL``, but ``RTLD_GLOBAL`` instead. Previously, using
|
||||||
|
@ -195,7 +195,6 @@ PyAPI_FUNC(void) PyEval_AcquireLock(void) Py_DEPRECATED(3.2);
|
|||||||
PyAPI_FUNC(void) PyEval_ReleaseLock(void) /* Py_DEPRECATED(3.2) */;
|
PyAPI_FUNC(void) PyEval_ReleaseLock(void) /* Py_DEPRECATED(3.2) */;
|
||||||
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
|
PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate);
|
||||||
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
|
PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate);
|
||||||
PyAPI_FUNC(void) PyEval_ReInitThreads(void);
|
|
||||||
|
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
|
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
|
||||||
|
@ -24,6 +24,8 @@ PyAPI_FUNC(int) _PyEval_AddPendingCall(
|
|||||||
void *arg);
|
void *arg);
|
||||||
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(
|
PyAPI_FUNC(void) _PyEval_SignalAsyncExc(
|
||||||
struct _ceval_runtime_state *ceval);
|
struct _ceval_runtime_state *ceval);
|
||||||
|
PyAPI_FUNC(void) _PyEval_ReInitThreads(
|
||||||
|
_PyRuntimeState *runtime);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
The :c:func:`PyEval_ReInitThreads` function has been removed from the C API.
|
||||||
|
It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child` instead.
|
@ -25,14 +25,25 @@
|
|||||||
#define PY_SSIZE_T_CLEAN
|
#define PY_SSIZE_T_CLEAN
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#ifdef MS_WINDOWS
|
||||||
|
/* include <windows.h> early to avoid conflict with pycore_condvar.h:
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "pycore_ceval.h" /* _PyEval_ReInitThreads() */
|
||||||
|
#include "pycore_pystate.h" /* _PyRuntime */
|
||||||
#include "pythread.h"
|
#include "pythread.h"
|
||||||
#include "structmember.h"
|
#include "structmember.h"
|
||||||
#ifndef MS_WINDOWS
|
#ifndef MS_WINDOWS
|
||||||
#include "posixmodule.h"
|
# include "posixmodule.h"
|
||||||
#else
|
#else
|
||||||
#include "winreparse.h"
|
# include "winreparse.h"
|
||||||
#endif
|
#endif
|
||||||
#include "pycore_pystate.h"
|
|
||||||
|
|
||||||
/* On android API level 21, 'AT_EACCESS' is not declared although
|
/* On android API level 21, 'AT_EACCESS' is not declared although
|
||||||
* HAVE_FACCESSAT is defined. */
|
* HAVE_FACCESSAT is defined. */
|
||||||
@ -424,7 +435,7 @@ PyOS_AfterFork_Child(void)
|
|||||||
_PyRuntimeState *runtime = &_PyRuntime;
|
_PyRuntimeState *runtime = &_PyRuntime;
|
||||||
_PyGILState_Reinit(runtime);
|
_PyGILState_Reinit(runtime);
|
||||||
_PyInterpreterState_DeleteExceptMain(runtime);
|
_PyInterpreterState_DeleteExceptMain(runtime);
|
||||||
PyEval_ReInitThreads();
|
_PyEval_ReInitThreads(runtime);
|
||||||
_PyImport_ReInitLock();
|
_PyImport_ReInitLock();
|
||||||
_PySignal_AfterFork();
|
_PySignal_AfterFork();
|
||||||
_PyRuntimeState_ReInitThreads(runtime);
|
_PyRuntimeState_ReInitThreads(runtime);
|
||||||
|
@ -289,9 +289,8 @@ PyEval_ReleaseThread(PyThreadState *tstate)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
PyEval_ReInitThreads(void)
|
_PyEval_ReInitThreads(_PyRuntimeState *runtime)
|
||||||
{
|
{
|
||||||
_PyRuntimeState *runtime = &_PyRuntime;
|
|
||||||
struct _ceval_runtime_state *ceval = &runtime->ceval;
|
struct _ceval_runtime_state *ceval = &runtime->ceval;
|
||||||
if (!gil_created(&ceval->gil)) {
|
if (!gil_created(&ceval->gil)) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user