summaryrefslogtreecommitdiffstats
path: root/Modules/readline.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 /Modules/readline.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 'Modules/readline.c')
-rw-r--r--Modules/readline.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index d42998e..98da33b 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -1002,16 +1002,29 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
PyDoc_STRVAR(doc_module,
"Importing this module enables command line editing using GNU readline.");
+
+static struct PyModuleDef readlinemodule = {
+ PyModuleDef_HEAD_INIT,
+ "readline",
+ doc_module,
+ -1,
+ readline_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-initreadline(void)
+PyInit_readline(void)
{
PyObject *m;
- m = Py_InitModule4("readline", readline_methods, doc_module,
- (PyObject *)NULL, PYTHON_API_VERSION);
+ m = PyModule_Create(&readlinemodule);
if (m == NULL)
- return;
+ return NULL;
PyOS_ReadlineFunctionPointer = call_readline;
setup_readline();
+ return m;
}