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/_cursesmodule.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/_cursesmodule.c')
-rw-r--r-- | Modules/_cursesmodule.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index bde086d..45a0821 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -2770,8 +2770,21 @@ static PyMethodDef PyCurses_methods[] = { /* Initialization function for the module */ + +static struct PyModuleDef _cursesmodule = { + PyModuleDef_HEAD_INIT, + "_curses", + NULL, + -1, + PyCurses_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_curses(void) +PyInit__curses(void) { PyObject *m, *d, *v, *c_api_object; static void *PyCurses_API[PyCurses_API_pointers]; @@ -2786,14 +2799,14 @@ init_curses(void) PyCurses_API[3] = (void *)func_PyCursesInitialisedColor; /* Create the module and add the functions */ - m = Py_InitModule("_curses", PyCurses_methods); + m = PyModule_Create(&_cursesmodule); if (m == NULL) - return; + return NULL; /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); if (d == NULL) - return; + return NULL; ModDict = d; /* For PyCurses_InitScr to use later */ /* Add a CObject for the C API */ @@ -2931,4 +2944,5 @@ init_curses(void) SetDictInt("KEY_MIN", KEY_MIN); SetDictInt("KEY_MAX", KEY_MAX); } + return m; } |