For explaining this issue, some information must be listed about the CTRL-Z (0x1A):
On CYGWIN:
Opening with open() in binary mode, it handles it as a clean flow of data without translations.
Opening with open() in text mode, it translates all 0xA to 0xD 0xA and the read() function ignores the CTRL-Z character as EOF.
Opening with fopen() in text mode, it also accepts the CTRL-Z as the EOF condition and this stops receiving data from fread().
On native WIN32:
both open() and fopen() work in the same way if they open the file in text mode and CTRL-Z is treated as End-Of-File at both high and low levels, so read() and fread() give you the same results.
So, that's why this test is failing here.
In short, this kind of test cannot be executed on CYGWIN because read() never blocks on CTRL-Z by design.
I would like to suggest to avoid it, if it happens.
The patch itself is simple, I think that it is just need to write this before test_textmode:
@unittest.skipUnless(sys.platform != "cygwin" and has_textmode, "text mode not available")
Activity
pythongh-149946: Avoid testing textmode on read() with CYGWIN.
carlo-bramini commented on May 19, 2026
See also discussion at issue #149879
carlo-bramini commented on May 19, 2026
Fixed by PR #150081