summaryrefslogtreecommitdiffstats
path: root/Modules/resource.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/resource.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/resource.c')
-rw-r--r--Modules/resource.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/resource.c b/Modules/resource.c
index d67fe99..294ea92 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -225,15 +225,28 @@ resource_methods[] = {
/* Module initialization */
+
+static struct PyModuleDef resourcemodule = {
+ PyModuleDef_HEAD_INIT,
+ "resource",
+ NULL,
+ -1,
+ resource_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-initresource(void)
+PyInit_resource(void)
{
PyObject *m, *v;
/* Create the module and add the functions */
- m = Py_InitModule("resource", resource_methods);
+ m = PyModule_Create(&resourcemodule);
if (m == NULL)
- return;
+ return NULL;
/* Add some symbolic constants to the module */
if (ResourceError == NULL) {
@@ -326,4 +339,5 @@ initresource(void)
PyModule_AddObject(m, "RLIM_INFINITY", v);
}
initialized = 1;
+ return m;
}