bpo-1635741: port scproxy to multi-phase init (GH-22164)

This commit is contained in:
Mohamed Koubaa 2020-09-08 22:28:48 -05:00 committed by GitHub
parent 58de1dd6a8
commit 3ff6975e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 14 deletions

View File

@ -0,0 +1,2 @@
Port the :mod:`_scproxy` extension module to multi-phase initialization
(:pep:`489`).

View File

@ -231,20 +231,17 @@ static PyMethodDef mod_methods[] = {
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
static PyModuleDef_Slot _scproxy_slots[] = {
{0, NULL}
static struct PyModuleDef mod_module = {
PyModuleDef_HEAD_INIT,
"_scproxy",
NULL,
-1,
mod_methods,
NULL,
NULL,
NULL,
NULL
}; };
static struct PyModuleDef _scproxy_module = {
PyModuleDef_HEAD_INIT,
.m_name = "_scproxy",
.m_size = 0,
.m_methods = mod_methods,
.m_slots = _scproxy_slots,
};
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -253,10 +250,9 @@ extern "C" {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit__scproxy(void) PyInit__scproxy(void)
{ {
return PyModule_Create(&mod_module); return PyModuleDef_Init(&_scproxy_module);
} }
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif