mirror of
https://github.com/python/cpython.git
synced 2025-09-01 14:38:00 +00:00
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 :-)
This commit is contained in:
parent
b6a4716298
commit
3d26cc9542
1 changed files with 10 additions and 8 deletions
|
@ -228,6 +228,16 @@ Py_Main(argc, argv)
|
||||||
|
|
||||||
PySys_SetArgv(argc-optind, argv+optind);
|
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) {
|
if (command) {
|
||||||
sts = PyRun_SimpleString(command) != 0;
|
sts = PyRun_SimpleString(command) != 0;
|
||||||
free(command);
|
free(command);
|
||||||
|
@ -243,14 +253,6 @@ Py_Main(argc, argv)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isatty(fileno(stdin))) {
|
|
||||||
PyObject *v;
|
|
||||||
v = PyImport_ImportModule("readline");
|
|
||||||
if (v == NULL)
|
|
||||||
PyErr_Clear();
|
|
||||||
else
|
|
||||||
Py_DECREF(v);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sts = PyRun_AnyFile(
|
sts = PyRun_AnyFile(
|
||||||
fp,
|
fp,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue