summaryrefslogtreecommitdiff
path: root/Modules/termios.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 /Modules/termios.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-git-1a21451b1d73b65af949193208372e86bf308411.tar.gz
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/termios.c')
-rw-r--r--Modules/termios.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/Modules/termios.c b/Modules/termios.c
index ff69c92f53..9fccb2e830 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;
}