From 3d26cc9542a9ee4ad31e54011ac0d809ba6ff6fa Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 16 Sep 1997 16:11:28 +0000 Subject: Move the "import readline" to an earlier place so it is also done when "-i" is given. (Yes, I know, giving in to Marc Lemburg who wanted this :-) --- Modules/main.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Modules/main.c b/Modules/main.c index b882ff9..ef18fe6 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -228,6 +228,16 @@ Py_Main(argc, argv) PySys_SetArgv(argc-optind, argv+optind); + if ((inspect || (command == NULL && filename == NULL)) && + isatty(fileno(stdin))) { + PyObject *v; + v = PyImport_ImportModule("readline"); + if (v == NULL) + PyErr_Clear(); + else + Py_DECREF(v); + } + if (command) { sts = PyRun_SimpleString(command) != 0; free(command); @@ -243,14 +253,6 @@ Py_Main(argc, argv) fclose(fp); } } - if (isatty(fileno(stdin))) { - PyObject *v; - v = PyImport_ImportModule("readline"); - if (v == NULL) - PyErr_Clear(); - else - Py_DECREF(v); - } } sts = PyRun_AnyFile( fp, -- cgit v0.12