diff options
author | Victor Stinner <vstinner@python.org> | 2020-09-04 12:51:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 12:51:05 (GMT) |
commit | 4b8032e5a4994a7902076efa72fca1e2c85d8b7f (patch) | |
tree | c8fa71748e52980541b23ae5698b77bf75ee3f58 /Modules/signalmodule.c | |
parent | 54a66ade2067c373d31003ad260e1b7d14c81564 (diff) | |
download | cpython-4b8032e5a4994a7902076efa72fca1e2c85d8b7f.zip cpython-4b8032e5a4994a7902076efa72fca1e2c85d8b7f.tar.gz cpython-4b8032e5a4994a7902076efa72fca1e2c85d8b7f.tar.bz2 |
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.
Diffstat (limited to 'Modules/signalmodule.c')
-rw-r--r-- | Modules/signalmodule.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 262f2b6..3440894 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -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) { |