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. --- Modules/_heapqmodule.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Modules/_heapqmodule.c') diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c index a5a56053d6..9d2bb1a439 100644 --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -679,15 +679,29 @@ backwards, and this was also used to avoid the rewinding time.\n\ Believe me, real good tape sorts were quite spectacular to watch!\n\ From all times, sorting has always been a Great Art! :-)\n"); + +static struct PyModuleDef _heapqmodule = { + PyModuleDef_HEAD_INIT, + "_heapq", + module_doc, + -1, + heapq_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_heapq(void) +PyInit__heapq(void) { PyObject *m, *about; - m = Py_InitModule3("_heapq", heapq_methods, module_doc); + m = PyModule_Create(&_heapqmodule); if (m == NULL) - return; + return NULL; about = PyUnicode_DecodeUTF8(__about__, strlen(__about__), NULL); PyModule_AddObject(m, "__about__", about); + return m; } -- cgit v1.2.1