diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 +0000 |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 +0000 |
| commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
| tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /PC/_subprocess.c | |
| parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
| download | cpython-git-1a21451b1d73b65af949193208372e86bf308411.tar.gz | |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'PC/_subprocess.c')
| -rw-r--r-- | PC/_subprocess.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c index a75295054d..c256ca35d8 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; } |
