diff options
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r-- | Modules/_sre.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 22aff76e3c..ab8addacd5 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -3387,7 +3387,19 @@ static PyMethodDef _functions[] = { {NULL, NULL} }; -PyMODINIT_FUNC init_sre(void) +static struct PyModuleDef sremodule = { + PyModuleDef_HEAD_INIT, + "_" SRE_MODULE, + NULL, + -1, + _functions, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC PyInit__sre(void) { PyObject* m; PyObject* d; @@ -3395,15 +3407,15 @@ PyMODINIT_FUNC init_sre(void) /* Initialize object types */ if (PyType_Ready(&Pattern_Type) < 0) - return; + return NULL; if (PyType_Ready(&Match_Type) < 0) - return; + return NULL; if (PyType_Ready(&Scanner_Type) < 0) - return; + return NULL; - m = Py_InitModule("_" SRE_MODULE, _functions); + m = PyModule_Create(&sremodule); if (m == NULL) - return; + return NULL; d = PyModule_GetDict(m); x = PyLong_FromLong(SRE_MAGIC); @@ -3423,6 +3435,7 @@ PyMODINIT_FUNC init_sre(void) PyDict_SetItemString(d, "copyright", x); Py_DECREF(x); } + return m; } #endif /* !defined(SRE_RECURSIVE) */ |