summaryrefslogtreecommitdiffstats
path: root/PC/winsound.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/winsound.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/winsound.c')
-rw-r--r--PC/winsound.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/PC/winsound.c b/PC/winsound.c
index 62e87ae..da5dea9 100644
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -163,15 +163,26 @@ add_define(PyObject *dict, const char *key, long value)
#define ADD_DEFINE(tok) add_define(dict,#tok,tok)
+
+static struct PyModuleDef winsoundmodule = {
+ PyModuleDef_HEAD_INIT,
+ "winsound",
+ sound_module_doc,
+ -1,
+ sound_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-initwinsound(void)
+PyInit_winsound(void)
{
PyObject *dict;
- PyObject *module = Py_InitModule3("winsound",
- sound_methods,
- sound_module_doc);
+ PyObject *module = PyModule_Create(&winsoundmodule);
if (module == NULL)
- return;
+ return NULL;
dict = PyModule_GetDict(module);
ADD_DEFINE(SND_ASYNC);
@@ -190,4 +201,5 @@ initwinsound(void)
ADD_DEFINE(MB_ICONEXCLAMATION);
ADD_DEFINE(MB_ICONHAND);
ADD_DEFINE(MB_ICONQUESTION);
+ return module;
}