]> granicus.if.org Git - python/commitdiff
Move the "import readline" to an earlier place so it is also done when
authorGuido van Rossum <guido@python.org>
Tue, 16 Sep 1997 16:11:28 +0000 (16:11 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Sep 1997 16:11:28 +0000 (16:11 +0000)
"-i" is given.  (Yes, I know, giving in to Marc Lemburg who wanted
this :-)

Modules/main.c

index b882ff9e00bb05b1d7e4a3f8a854d9f35ee2f1ea..ef18fe64cd5cddc2305e9c711966594b6ce9e096 100644 (file)
@@ -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,