Skip to content

test_ioctl failing on MacOS #132843

Closed

Description

@smontanaro

Bug report

Bug description:

A new test, test_ioctl.test_ioctl_tcflush, fails for me on M1 MacBook Pro (Sequoia 15.4.1) because termios doesn't have a TCFLSH attribute.

% ./python.exe -m test test_ioctl
Using random seed: 2942680825
0:00:00 load avg: 1.77 Run 1 test sequentially in a single process
0:00:00 load avg: 1.77 [1/1] test_ioctl
test test_ioctl failed -- Traceback (most recent call last):
  File "/Users/skip/src/python/cpython/Lib/test/test_ioctl.py", line 137, in test_ioctl_tcflush
    r = fcntl.ioctl(tty, termios.TCFLSH, termios.TCIFLUSH)
                         ^^^^^^^^^^^^^^
AttributeError: module 'termios' has no attribute 'TCFLSH'. Did you mean: 'CFLUSH'?

0:00:00 load avg: 1.77 [1/1/1] test_ioctl failed (1 error)

== Tests result: FAILURE ==

1 test failed:
    test_ioctl

Total duration: 20 ms
Total tests: run=8
Total test files: run=1/1 failed=1
Result: FAILURE

Here's what termios does have which resembles "flush":

>>> [a for a in dir(termios) if "FLUSH" in a or "FLSH" in a]
['CFLUSH', 'FLUSHO', 'NOFLSH', 'TCIFLUSH', 'TCIOFLUSH', 'TCOFLUSH', 'TCSAFLUSH', 'TIOCPKT_FLUSHREAD', 'TIOCPKT_FLUSHWRITE']

I saw no check for TCFLSH in configure, so presume it's expected to be widely available, but I know nothing about this stuff. Pinging @serhiy-storchaka .

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Activity

  1. serhiy-storchaka commented on Apr 23, 2025

    @serhiy-storchaka
    Member

    The test is passed on CI and builtbots because all these tests are skipped because "/dev/tty" is not available.

    I discovered this when worked on #132791. There are some issues with handling tcflush() and tcflow() on BSD/macOS, but the part of that PR which fixes dependency on "/dev/tty" and TCFLSH can be safely merged.

  2. added a commit that references this issue on Apr 23, 2025
  3. added a commit that references this issue on Apr 23, 2025
  4. added 2 commits that reference this issue on Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions