From c9a6ab56cfae90c96c1361314c3c99b32e114446 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Sat, 10 Oct 2015 01:25:38 +0000 Subject: Issue #24402: Fix input() when stdout.fileno() fails; diagnosed by Eryksun Also factored out some test cases into a new PtyTests class. --- Python/bltinmodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 4b4f979169..aed93e5352 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1723,8 +1723,10 @@ builtin_input(PyObject *self, PyObject *args) } if (tty) { tmp = _PyObject_CallMethodId(fout, &PyId_fileno, ""); - if (tmp == NULL) + if (tmp == NULL) { PyErr_Clear(); + tty = 0; + } else { fd = PyLong_AsLong(tmp); Py_DECREF(tmp); -- cgit v1.2.1