From 566f6afe9a9de23132302020dcb4c612d5180f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sat, 26 Oct 2002 14:39:10 +0000 Subject: Patch #512981: Update readline input stream on sys.stdin/out change. --- Python/bltinmodule.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 2387deb667..7e7ad2ef60 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); -- cgit v1.2.1