summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2015-10-10 01:25:38 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2015-10-10 01:25:38 (GMT)
commitc9a6ab56cfae90c96c1361314c3c99b32e114446 (patch)
treec91481d3bf7f9f1c1ea440d8af45427e26bd1a4e /Python
parentff1f3d9ff195eb59076f20969f3a49ecf72067b4 (diff)
downloadcpython-c9a6ab56cfae90c96c1361314c3c99b32e114446.zip
cpython-c9a6ab56cfae90c96c1361314c3c99b32e114446.tar.gz
cpython-c9a6ab56cfae90c96c1361314c3c99b32e114446.tar.bz2
Issue #24402: Fix input() when stdout.fileno() fails; diagnosed by Eryksun
Also factored out some test cases into a new PtyTests class.
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 4b4f979..aed93e5 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);