]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)
authorChristian Heimes <christian@python.org>
Thu, 19 Nov 2020 15:20:42 +0000 (16:20 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Nov 2020 15:20:42 +0000 (07:20 -0800)
Signed-off-by: Christian Heimes <christian@python.org>
Misc/NEWS.d/next/C API/2020-11-19-15-33-42.bpo-1635741.9tVsZt.rst [new file with mode: 0644]
Modules/_multiprocessing/posixshmem.c

diff --git a/Misc/NEWS.d/next/C API/2020-11-19-15-33-42.bpo-1635741.9tVsZt.rst b/Misc/NEWS.d/next/C API/2020-11-19-15-33-42.bpo-1635741.9tVsZt.rst
new file mode 100644 (file)
index 0000000..201b7ae
--- /dev/null
@@ -0,0 +1 @@
+Port _posixshmem extension module to multiphase initialization (:pep:`489`)
index 436ac6d6b39f49b7d5a271794d0fbd4f4dbfa93e..d64ded4168228f817d5da888a740843bbec6d5fb 100644 (file)
@@ -110,21 +110,17 @@ static PyMethodDef module_methods[ ] = {
 };
 
 
-static struct PyModuleDef this_module = {
-    PyModuleDef_HEAD_INIT,  // m_base
-    "_posixshmem",          // m_name
-    "POSIX shared memory module",     // m_doc
-    -1,                     // m_size (space allocated for module globals)
-    module_methods,         // m_methods
+static struct PyModuleDef _posixshmemmodule = {
+    PyModuleDef_HEAD_INIT,
+    .m_name = "_posixshmem",
+    .m_doc = "POSIX shared memory module",
+    .m_size = 0,
+    .m_methods = module_methods,
 };
 
 /* Module init function */
 PyMODINIT_FUNC
-PyInit__posixshmem(void) {
-    PyObject *module;
-    module = PyModule_Create(&this_module);
-    if (!module) {
-        return NULL;
-    }
-    return module;
+PyInit__posixshmem(void)
+{
+    return PyModuleDef_Init(&_posixshmemmodule);
 }