summaryrefslogtreecommitdiff
path: root/PC/msvcrtmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 +0000
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 +0000
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /PC/msvcrtmodule.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-git-1a21451b1d73b65af949193208372e86bf308411.tar.gz
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'PC/msvcrtmodule.c')
-rwxr-xr-xPC/msvcrtmodule.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
index aeab3b6d2f..225121f642 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;
}