Implement PEP 3121: new module initialization and finalization API.

This commit is contained in:
Martin v. Löwis 2008-06-11 05:26:20 +00:00
parent cdf94635d7
commit 1a21451b1d
113 changed files with 2230 additions and 855 deletions

View file

@ -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;
}