bpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)

Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
Christian Heimes 2020-11-19 16:20:42 +01:00 committed by GitHub
parent 588c7c9f08
commit b437aa83f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View file

@ -0,0 +1 @@
Port _posixshmem extension module to multiphase initialization (:pep:`489`)

View 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);
}