summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-16 16:11:28 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-16 16:11:28 (GMT)
commit3d26cc9542a9ee4ad31e54011ac0d809ba6ff6fa (patch)
tree7c5e0f7f87d8e88ece90b99e5f4704424c222a88 /Modules/main.c
parentb6a47162989ef02d627308838a12092fd6e050b8 (diff)
downloadcpython-3d26cc9542a9ee4ad31e54011ac0d809ba6ff6fa.zip
cpython-3d26cc9542a9ee4ad31e54011ac0d809ba6ff6fa.tar.gz
cpython-3d26cc9542a9ee4ad31e54011ac0d809ba6ff6fa.tar.bz2
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 :-)
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c18
1 files 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,