summaryrefslogtreecommitdiffstats
path: root/PC/_subprocess.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 /PC/_subprocess.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 'PC/_subprocess.c')
-rw-r--r--PC/_subprocess.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index a752950..c256ca3 100644
--- a/PC/_subprocess.c
+++ b/PC/_subprocess.c
@@ -541,12 +541,20 @@ defint(PyObject* d, const char* name, int value)
}
}
-#if PY_VERSION_HEX >= 0x02030000
+static struct PyModuleDef _subprocessmodule = {
+ PyModuleDef_HEAD_INIT,
+ "_subprocess",
+ NULL,
+ -1,
+ sp_functions,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-#else
-DL_EXPORT(void)
-#endif
-init_subprocess()
+PyInit__subprocess()
{
PyObject *d;
PyObject *m;
@@ -555,9 +563,9 @@ init_subprocess()
Py_TYPE(&sp_handle_type) = &PyType_Type;
sp_handle_as_number.nb_int = (unaryfunc) sp_handle_as_int;
- m = Py_InitModule("_subprocess", sp_functions);
+ m = PyModule_Create(&_subprocessmodule);
if (m == NULL)
- return;
+ return NULL;
d = PyModule_GetDict(m);
/* constants */
@@ -571,4 +579,5 @@ init_subprocess()
defint(d, "INFINITE", INFINITE);
defint(d, "WAIT_OBJECT_0", WAIT_OBJECT_0);
defint(d, "CREATE_NEW_CONSOLE", CREATE_NEW_CONSOLE);
+ return m;
}