From 1a21451b1d73b65af949193208372e86bf308411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Wed, 11 Jun 2008 05:26:20 +0000 Subject: Implement PEP 3121: new module initialization and finalization API. --- Python/marshal.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Python/marshal.c') diff --git a/Python/marshal.c b/Python/marshal.c index b1c8dd6f3a..d4755c9d67 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1191,11 +1191,26 @@ static PyMethodDef marshal_methods[] = { {NULL, NULL} /* sentinel */ }; +static struct PyModuleDef impmodule = { + PyModuleDef_HEAD_INIT, + "marshal", + NULL, + 0, + marshal_methods, + NULL, + NULL, + NULL, + NULL +}; + + + PyMODINIT_FUNC PyMarshal_Init(void) { - PyObject *mod = Py_InitModule("marshal", marshal_methods); + PyObject *mod = PyModule_Create(&impmodule); if (mod == NULL) - return; + return NULL; PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION); + return mod; } -- cgit v1.2.1