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 /Modules/_curses_panel.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 'Modules/_curses_panel.c')
-rw-r--r-- | Modules/_curses_panel.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index 9bdd194..867be7d 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -451,8 +451,21 @@ static PyMethodDef PyCurses_methods[] = { /* Initialization function for the module */ + +static struct PyModuleDef _curses_panelmodule = { + PyModuleDef_HEAD_INIT, + "_curses_panel", + NULL, + -1, + PyCurses_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_curses_panel(void) +PyInit__curses_panel(void) { PyObject *m, *d, *v; @@ -462,9 +475,9 @@ init_curses_panel(void) import_curses(); /* Create the module and add the functions */ - m = Py_InitModule("_curses_panel", PyCurses_methods); + m = PyModule_Create(&_curses_panelmodule); if (m == NULL) - return; + return NULL; d = PyModule_GetDict(m); /* For exception _curses_panel.error */ @@ -476,4 +489,5 @@ init_curses_panel(void) PyDict_SetItemString(d, "version", v); PyDict_SetItemString(d, "__version__", v); Py_DECREF(v); + return m; } |