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