diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /PC/msvcrtmodule.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-1a21451b1d73b65af949193208372e86bf308411.zip cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2 |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'PC/msvcrtmodule.c')
-rwxr-xr-x | PC/msvcrtmodule.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index aeab3b6..225121f 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -358,13 +358,26 @@ static struct PyMethodDef msvcrt_functions[] = { {NULL, NULL} }; + +static struct PyModuleDef msvcrtmodule = { + PyModuleDef_HEAD_INIT, + "msvcrt", + NULL, + -1, + msvcrt_functions, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initmsvcrt(void) +PyInit_msvcrt(void) { PyObject *d; - PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); + PyObject *m = PyModule_Create(&msvcrtmodule); if (m == NULL) - return; + return NULL; d = PyModule_GetDict(m); /* constants for the locking() function's mode argument */ @@ -389,4 +402,5 @@ initmsvcrt(void) insertint(d, "CRTDBG_FILE_STDOUT", (int)_CRTDBG_FILE_STDOUT); insertint(d, "CRTDBG_REPORT_FILE", (int)_CRTDBG_REPORT_FILE); #endif + return m; } |