[issue44887] test_input_tty hangs when run multiple times in the same process on macOS 10.15

Andrei Kulakov report at bugs.python.org
Fri Nov 12 19:49:20 EST 2021


Andrei Kulakov <andrei.avk at gmail.com> added the comment:

I've looked into this and the hang happens on this line:

https://github.com/python/cpython/blob/de3db1448b1b983eeb9f4498d07e3d2f1fb6d29d/Lib/test/test_builtin.py#L2030

So the issue is that on the second run, there's nothing to read on that fd. I've tried using os.stat to check if there's data on the fd, but it returned 0 data in both 1st and 2nd runs.

However, if a small sleep is added before running os.stat, it does return size of data on 1st run and returns 0 on 2nd run, meaning it's possible to avoid the hang and error out instead (is that an improvement?)

This is on MacOS 11.4 Big Sur by the way.

This is my test debug branch:

https://github.com/python/cpython/compare/main...akulakov:Test-check_input_tty-FIX?expand=1

----------
nosy: +andrei.avk, kj

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44887>
_______________________________________


More information about the Python-bugs-list mailing list