Issue #24402: Merge input() fix from 3.5

This commit is contained in:
Martin Panter 2015-10-10 02:09:41 +00:00
commit 5344da5c0d
3 changed files with 119 additions and 77 deletions

View file

@ -1854,8 +1854,10 @@ builtin_input_impl(PyModuleDef *module, PyObject *prompt)
}
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);