diff options
author | Christian Heimes <christian@python.org> | 2020-11-19 15:20:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 15:20:42 (GMT) |
commit | b437aa83f9374b86b7756705e8dc83b72a99e037 (patch) | |
tree | 54448f88cc2a96b8edcc0b6cd015bd8595bcd0b2 /Modules | |
parent | 588c7c9f08a673472a29e3f8f7fda9e343212e7d (diff) | |
download | cpython-b437aa83f9374b86b7756705e8dc83b72a99e037.zip cpython-b437aa83f9374b86b7756705e8dc83b72a99e037.tar.gz cpython-b437aa83f9374b86b7756705e8dc83b72a99e037.tar.bz2 |
bpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_multiprocessing/posixshmem.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c index 436ac6d..d64ded4 100644 --- a/Modules/_multiprocessing/posixshmem.c +++ b/Modules/_multiprocessing/posixshmem.c @@ -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); } |