bpo-41713: _signal doesn't use multi-phase init (GH-22087)

Partially revert commit 71d1bd9569c8a497e279f2fea6fe47cd70a87ea3:
don't use multi-phase initialization (PEP 489) for the _signal
extension module.
This commit is contained in:
Victor Stinner 2020-09-04 14:51:05 +02:00 committed by GitHub
parent 54a66ade20
commit 4b8032e5a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

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

View File

@ -1649,26 +1649,32 @@ signal_exec(PyObject *m)
return 0;
}
static PyModuleDef_Slot signal_slots[] = {
{Py_mod_exec, signal_exec},
{0, NULL}
};
static struct PyModuleDef signalmodule = {
PyModuleDef_HEAD_INIT,
"_signal",
.m_doc = module_doc,
.m_size = 0,
.m_size = -1,
.m_methods = signal_methods,
.m_slots = signal_slots
};
PyMODINIT_FUNC
PyInit__signal(void)
{
return PyModuleDef_Init(&signalmodule);
PyObject *mod = PyModule_Create(&signalmodule);
if (mod == NULL) {
return NULL;
}
if (signal_exec(mod) < 0) {
Py_DECREF(mod);
return NULL;
}
return mod;
}
static void
finisignal(void)
{