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/termios.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/termios.c')
-rw-r--r-- | Modules/termios.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Modules/termios.c b/Modules/termios.c index ff69c92..9fccb2e 100644 --- a/Modules/termios.c +++ b/Modules/termios.c @@ -2,8 +2,6 @@ #include "Python.h" -#define PyInit_termios inittermios - /* Apparently, on SGI, termios.h won't define CTRL if _XOPEN_SOURCE is defined, so we define it here. */ #if defined(__sgi) @@ -902,16 +900,27 @@ static struct constant { }; +static struct PyModuleDef termiosmodule = { + PyModuleDef_HEAD_INIT, + "termios", + termios__doc__, + -1, + termios_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC PyInit_termios(void) { PyObject *m; struct constant *constant = termios_constants; - m = Py_InitModule4("termios", termios_methods, termios__doc__, - (PyObject *)NULL, PYTHON_API_VERSION); + m = PyModule_Create(&termiosmodule); if (m == NULL) - return; + return NULL; if (TermiosError == NULL) { TermiosError = PyErr_NewException("termios.error", NULL, NULL); @@ -923,4 +932,5 @@ PyInit_termios(void) PyModule_AddIntConstant(m, constant->name, constant->value); ++constant; } + return m; } |