diff Python/bltinmodule.c @ 25924:dc4a0336a2a3 legacy-trunk

Patch #512981: Update readline input stream on sys.stdin/out change.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 26 Oct 2002 14:39:10 +0000
parents 434bc1dea4f8
children 97f83542f8ee
line wrap: on
line diff
--- a/Python/bltinmodule.c	Sat Oct 26 13:47:44 2002 +0000
+++ b/Python/bltinmodule.c	Sat Oct 26 14:39:10 2002 +0000
@@ -1311,8 +1311,9 @@
 		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 @@
 			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);