diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/_collectionsmodule.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-1a21451b1d73b65af949193208372e86bf308411.zip cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2 |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r-- | Modules/_collectionsmodule.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index db07537..02ffb56 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1348,31 +1348,44 @@ PyDoc_STRVAR(module_doc, - defaultdict: dict subclass with a default value factory\n\ "); + +static struct PyModuleDef _collectionsmodule = { + PyModuleDef_HEAD_INIT, + "_collections", + module_doc, + -1, + NULL, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_collections(void) +PyInit__collections(void) { PyObject *m; - m = Py_InitModule3("_collections", NULL, module_doc); + m = PyModule_Create(&_collectionsmodule); if (m == NULL) - return; + return NULL; if (PyType_Ready(&deque_type) < 0) - return; + return NULL; Py_INCREF(&deque_type); PyModule_AddObject(m, "deque", (PyObject *)&deque_type); defdict_type.tp_base = &PyDict_Type; if (PyType_Ready(&defdict_type) < 0) - return; + return NULL; Py_INCREF(&defdict_type); PyModule_AddObject(m, "defaultdict", (PyObject *)&defdict_type); if (PyType_Ready(&dequeiter_type) < 0) - return; + return NULL; if (PyType_Ready(&dequereviter_type) < 0) - return; + return NULL; - return; + return m; } |