diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-10-26 14:39:10 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-10-26 14:39:10 (GMT) |
commit | 566f6afe9a9de23132302020dcb4c612d5180f23 (patch) | |
tree | 4475264f5fe2cd2183321e1dcd06fcd29dab9644 /Python/bltinmodule.c | |
parent | 88afe666daf18cb93f78b2e7e025cb469ef7f551 (diff) | |
download | cpython-566f6afe9a9de23132302020dcb4c612d5180f23.zip cpython-566f6afe9a9de23132302020dcb4c612d5180f23.tar.gz cpython-566f6afe9a9de23132302020dcb4c612d5180f23.tar.bz2 |
Patch #512981: Update readline input stream on sys.stdin/out change.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 2387deb..7e7ad2e 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1311,8 +1311,9 @@ builtin_raw_input(PyObject *self, PyObject *args) if (PyFile_WriteString(" ", fout) != 0) return NULL; } - if (PyFile_AsFile(fin) == stdin && PyFile_AsFile(fout) == stdout && - isatty(fileno(stdin)) && isatty(fileno(stdout))) { + if (PyFile_Check (fin) && PyFile_Check (fout) + && isatty(fileno(PyFile_AsFile(fin))) + && isatty(fileno(PyFile_AsFile(fout)))) { PyObject *po; char *prompt; char *s; @@ -1329,7 +1330,8 @@ builtin_raw_input(PyObject *self, PyObject *args) po = NULL; prompt = ""; } - s = PyOS_Readline(prompt); + s = PyOS_Readline(PyFile_AsFile (fin), PyFile_AsFile (fout), + prompt); Py_XDECREF(po); if (s == NULL) { PyErr_SetNone(PyExc_KeyboardInterrupt); |