summaryrefslogtreecommitdiffstats
path: root/Modules/_weakref.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/_weakref.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-1a21451b1d73b65af949193208372e86bf308411.zip
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/_weakref.c')
-rw-r--r--Modules/_weakref.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/Modules/_weakref.c b/Modules/_weakref.c
index b187a26..88995b8 100644
--- a/Modules/_weakref.c
+++ b/Modules/_weakref.c
@@ -88,13 +88,25 @@ weakref_functions[] = {
};
+static struct PyModuleDef weakrefmodule = {
+ PyModuleDef_HEAD_INIT,
+ "_weakref",
+ "Weak-reference support module.",
+ -1,
+ weakref_functions,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_weakref(void)
+PyInit__weakref(void)
{
PyObject *m;
- m = Py_InitModule3("_weakref", weakref_functions,
- "Weak-reference support module.");
+ m = PyModule_Create(&weakrefmodule);
+
if (m != NULL) {
Py_INCREF(&_PyWeakref_RefType);
PyModule_AddObject(m, "ref",
@@ -109,4 +121,5 @@ init_weakref(void)
PyModule_AddObject(m, "CallableProxyType",
(PyObject *) &_PyWeakref_CallableProxyType);
}
+ return m;
}