Implement PEP 3121: new module initialization and finalization API.
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 @@
 
 /* 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 @@
 		PyModule_AddObject(m, "RLIM_INFINITY", v);
 	}
 	initialized = 1;
+	return m;
 }