mirror of
https://github.com/python/cpython.git
synced 2024-11-24 08:52:25 +01:00
This commit is contained in:
parent
3ed3bc379a
commit
417dd3aca7
@ -634,7 +634,7 @@ state:
|
|||||||
|
|
||||||
.. versionadded:: 3.9
|
.. versionadded:: 3.9
|
||||||
|
|
||||||
.. c:function:: int PyModule_ExperimentalSetGIL(PyObject *module, void *gil)
|
.. c:function:: int PyUnstable_Module_SetGIL(PyObject *module, void *gil)
|
||||||
|
|
||||||
Indicate that *module* does or does not support running without the global
|
Indicate that *module* does or does not support running without the global
|
||||||
interpreter lock (GIL), using one of the values from
|
interpreter lock (GIL), using one of the values from
|
||||||
|
@ -101,7 +101,7 @@ struct PyModuleDef_Slot {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
|
#if !defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
|
||||||
PyAPI_FUNC(int) PyModule_ExperimentalSetGIL(PyObject *module, void *gil);
|
PyAPI_FUNC(int) PyUnstable_Module_SetGIL(PyObject *module, void *gil);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct PyModuleDef {
|
struct PyModuleDef {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Extension modules may indicate to the runtime that they can run without the
|
Extension modules may indicate to the runtime that they can run without the
|
||||||
GIL. Multi-phase init modules do so by calling providing
|
GIL. Multi-phase init modules do so by calling providing
|
||||||
``Py_MOD_GIL_NOT_USED`` for the ``Py_mod_gil`` slot, while single-phase init
|
``Py_MOD_GIL_NOT_USED`` for the ``Py_mod_gil`` slot, while single-phase init
|
||||||
modules call ``PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED)`` from
|
modules call ``PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED)`` from
|
||||||
their init function.
|
their init function.
|
||||||
|
@ -4753,7 +4753,7 @@ PyInit__curses(void)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Add some symbolic constants to the module */
|
/* Add some symbolic constants to the module */
|
||||||
|
@ -6985,7 +6985,7 @@ PyInit__datetime(void)
|
|||||||
if (mod == NULL)
|
if (mod == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_datetime_exec(mod) < 0) {
|
if (_datetime_exec(mod) < 0) {
|
||||||
|
@ -2902,7 +2902,7 @@ PyInit__testbuffer(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
if (_testbuffer_exec(mod) < 0) {
|
if (_testbuffer_exec(mod) < 0) {
|
||||||
Py_DECREF(mod);
|
Py_DECREF(mod);
|
||||||
|
@ -3936,7 +3936,7 @@ PyInit__testcapi(void)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Py_SET_TYPE(&_HashInheritanceTester_Type, &PyType_Type);
|
Py_SET_TYPE(&_HashInheritanceTester_Type, &PyType_Type);
|
||||||
|
@ -1956,7 +1956,7 @@ PyInit__testclinic(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
if (PyModule_AddType(m, &TestClass) < 0) {
|
if (PyModule_AddType(m, &TestClass) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -147,7 +147,7 @@ PyInit__testclinic_limited(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ PyInit__testexternalinspection(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
int rc = PyModule_AddIntConstant(mod, "PROCESS_VM_READV_SUPPORTED", HAVE_PROCESS_VM_READV);
|
int rc = PyModule_AddIntConstant(mod, "PROCESS_VM_READV_SUPPORTED", HAVE_PROCESS_VM_READV);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
@ -26,7 +26,7 @@ PyInit__testlimitedcapi(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_PyTestLimitedCAPI_Init_Abstract(mod) < 0) {
|
if (_PyTestLimitedCAPI_Init_Abstract(mod) < 0) {
|
||||||
|
@ -901,7 +901,7 @@ PyInit__test_module_state_shared(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (PyModule_AddObjectRef(module, "Error", PyExc_Exception) < 0) {
|
if (PyModule_AddObjectRef(module, "Error", PyExc_Exception) < 0) {
|
||||||
|
@ -472,7 +472,7 @@ init__testsinglephase_basic(PyModuleDef *def)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
module_state *state = &global_state.module;
|
module_state *state = &global_state.module;
|
||||||
@ -566,7 +566,7 @@ PyInit__testsinglephase_with_reinit(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert(get_module_state(module) == NULL);
|
assert(get_module_state(module) == NULL);
|
||||||
@ -631,7 +631,7 @@ PyInit__testsinglephase_with_state(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(module, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
module_state *state = get_module_state(module);
|
module_state *state = get_module_state(module);
|
||||||
|
@ -3206,7 +3206,7 @@ PyInit__tkinter(void)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
|
Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
|
||||||
|
@ -220,7 +220,7 @@ PyInit__tracemalloc(void)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_PyTraceMalloc_Init() < 0) {
|
if (_PyTraceMalloc_Init() < 0) {
|
||||||
|
@ -1553,7 +1553,7 @@ PyInit_readline(void)
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(m, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (PyModule_AddIntConstant(m, "_READLINE_VERSION",
|
if (PyModule_AddIntConstant(m, "_READLINE_VERSION",
|
||||||
|
@ -439,7 +439,7 @@ error:
|
|||||||
|
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
int
|
int
|
||||||
PyModule_ExperimentalSetGIL(PyObject *module, void *gil)
|
PyUnstable_Module_SetGIL(PyObject *module, void *gil)
|
||||||
{
|
{
|
||||||
if (!PyModule_Check(module)) {
|
if (!PyModule_Check(module)) {
|
||||||
PyErr_BadInternalCall();
|
PyErr_BadInternalCall();
|
||||||
|
@ -3125,7 +3125,7 @@ _PyBuiltin_Init(PyInterpreterState *interp)
|
|||||||
if (mod == NULL)
|
if (mod == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(mod, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
dict = PyModule_GetDict(mod);
|
dict = PyModule_GetDict(mod);
|
||||||
|
|
||||||
|
@ -3775,7 +3775,7 @@ _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p)
|
|||||||
return _PyStatus_ERR("failed to create a module object");
|
return _PyStatus_ERR("failed to create a module object");
|
||||||
}
|
}
|
||||||
#ifdef Py_GIL_DISABLED
|
#ifdef Py_GIL_DISABLED
|
||||||
PyModule_ExperimentalSetGIL(sysmod, Py_MOD_GIL_NOT_USED);
|
PyUnstable_Module_SetGIL(sysmod, Py_MOD_GIL_NOT_USED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyObject *sysdict = PyModule_GetDict(sysmod);
|
PyObject *sysdict = PyModule_GetDict(sysmod);
|
||||||
|
Loading…
Reference in New Issue
Block a user