Issue #24402: Merge input() fix from 3.4 into 3.5

This commit is contained in:
Martin Panter 2015-10-10 01:55:23 +00:00
commit e02f8fc44d
3 changed files with 116 additions and 77 deletions

View file

@ -1853,8 +1853,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);