Skip to content

Expose termios baud rate constants and IBSHIFT on Linux - #16474

Merged
srittau merged 3 commits into
python:mainfrom
anistark:fix-termios-glibc-baud
Oct 5, 2026
Merged

srittau merged 3 commits into
python:mainfrom
anistark:fix-termios-glibc-baud

Conversation

@anistark

@anistark anistark commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

When CPython is built against glibc 2.42 or newer, termios on Linux exposes B7200, B14400, B28800, B76800 (Python 3.13+) and IBSHIFT, but the stub only declares them on other platforms. glibc 2.42 added arbitrary baud rate support, which defines these macros, and termios.c exports them whenever they are defined (IBSHIFT).

Declare the B* constants for 3.13+ on all non-Windows platforms and IBSHIFT on all non-macOS platforms, with optional stubtest allowlist entries because the GitHub Actions runners build against an older glibc.

Prepared with Claude Code.

When CPython is built against glibc 2.42 or newer, the termios module
on Linux exposes B7200, B14400, B28800, B76800 (Python 3.13+) and
IBSHIFT, but the stub only declared them on other platforms.

- Declare the B* constants for Python 3.13+ on all non-Windows platforms
- Declare IBSHIFT on all non-macOS platforms, including Linux
- Allowlist them as optional for stubtest, since the GitHub Actions
  runners build against an older glibc that lacks the macros
@anistark
anistark force-pushed the fix-termios-glibc-baud branch from 4ef1ea2 to eeb5fab Compare October 4, 2026 11:56
@github-actions

This comment has been minimized.

Comment thread stdlib/@tests/stubtest_allowlists/linux.txt
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@anistark
anistark requested a review from srittau October 5, 2026 13:41

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau
srittau merged commit 5d9cd84 into python:main Oct 5, 2026
88 checks passed
@anistark
anistark deleted the fix-termios-glibc-baud branch October 5, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants