From 417dd3aca7bb910691d34e54fee108d7bbc627d3 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 6 May 2024 18:59:36 +0200 Subject: [PATCH] gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) --- Doc/c-api/module.rst | 2 +- Include/moduleobject.h | 2 +- .../2024-03-12-13-51-09.gh-issue-116322.q8TcDQ.rst | 2 +- Modules/_cursesmodule.c | 2 +- Modules/_datetimemodule.c | 2 +- Modules/_testbuffer.c | 2 +- Modules/_testcapimodule.c | 2 +- Modules/_testclinic.c | 2 +- Modules/_testclinic_limited.c | 2 +- Modules/_testexternalinspection.c | 2 +- Modules/_testlimitedcapi.c | 2 +- Modules/_testmultiphase.c | 2 +- Modules/_testsinglephase.c | 6 +++--- Modules/_tkinter.c | 2 +- Modules/_tracemalloc.c | 2 +- Modules/readline.c | 2 +- Objects/moduleobject.c | 2 +- Python/bltinmodule.c | 2 +- Python/sysmodule.c | 2 +- 19 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 86308d921f4..6fe1ce9e994 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -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 diff --git a/Include/moduleobject.h b/Include/moduleobject.h index 6afa3c7be37..2a17c891dda 100644 --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -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 { diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-03-12-13-51-09.gh-issue-116322.q8TcDQ.rst b/Misc/NEWS.d/next/Core and Builtins/2024-03-12-13-51-09.gh-issue-116322.q8TcDQ.rst index 2d3bf411a5a..1f718a23780 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2024-03-12-13-51-09.gh-issue-116322.q8TcDQ.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2024-03-12-13-51-09.gh-issue-116322.q8TcDQ.rst @@ -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. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 69b97042b89..ee3d4c6eae7 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -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 */ diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index 00015c5d8c2..8164715a66f 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -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) { diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c index 35d4ffecad6..54ee4688032 100644 --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -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); diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index e7e342e529e..ff31724c0e9 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -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); diff --git a/Modules/_testclinic.c b/Modules/_testclinic.c index c7af552f029..4187e13231d 100644 --- a/Modules/_testclinic.c +++ b/Modules/_testclinic.c @@ -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; diff --git a/Modules/_testclinic_limited.c b/Modules/_testclinic_limited.c index d5f98085f84..370433b3e2a 100644 --- a/Modules/_testclinic_limited.c +++ b/Modules/_testclinic_limited.c @@ -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; } diff --git a/Modules/_testexternalinspection.c b/Modules/_testexternalinspection.c index d9c65fe253f..696c00c237d 100644 --- a/Modules/_testexternalinspection.c +++ b/Modules/_testexternalinspection.c @@ -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) { diff --git a/Modules/_testlimitedcapi.c b/Modules/_testlimitedcapi.c index f88476f4be2..fb5cdb6ca9e 100644 --- a/Modules/_testlimitedcapi.c +++ b/Modules/_testlimitedcapi.c @@ -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) { diff --git a/Modules/_testmultiphase.c b/Modules/_testmultiphase.c index ca3d83233c5..886b260aceb 100644 --- a/Modules/_testmultiphase.c +++ b/Modules/_testmultiphase.c @@ -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) { diff --git a/Modules/_testsinglephase.c b/Modules/_testsinglephase.c index c0eb266751e..448be502466 100644 --- a/Modules/_testsinglephase.c +++ b/Modules/_testsinglephase.c @@ -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); diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index ecb7ca8de62..3d1cff2fa52 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -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); diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 55028dc3a65..887a1e820e2 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -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) { diff --git a/Modules/readline.c b/Modules/readline.c index f59f8a9834c..35655c70a46 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -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", diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index a570b13e120..46995b948a2 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -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(); diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 88d858dc944..e7b60ebca5e 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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); diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 69bee32987f..417040c891f 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -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);