mirror of
https://github.com/python/cpython.git
synced 2025-07-18 16:55:20 +00:00
Issue #24402: Fix input() when stdout.fileno() fails; diagnosed by Eryksun
Also factored out some test cases into a new PtyTests class.
This commit is contained in:
parent
ff1f3d9ff1
commit
c9a6ab56cf
3 changed files with 116 additions and 77 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue