Skip to content

Commit 4ef1ea2

Browse files
anistarkclaude
andcommitted
Expose termios baud rate constants and IBSHIFT on Linux
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 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9093590 commit 4ef1ea2

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎stdlib/@tests/stubtest_allowlists/linux.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,5 +137,12 @@ _?socket.SOL_ROSE
137137
# not present on GitHub Actions runners.
138138
termios.TIOCTTYGSTRUCT
139139

140+
# Only defined when Python was built against glibc 2.42 or newer
141+
(termios.B7200)?
142+
(termios.B14400)?
143+
(termios.B28800)?
144+
(termios.B76800)?
145+
(termios.IBSHIFT)?
146+
140147
tkinter.Tk.createfilehandler # Methods that come from __getattr__() at runtime
141148
tkinter.Tk.deletefilehandler # Methods that come from __getattr__() at runtime

‎stdlib/termios.pyi‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ if sys.platform != "win32":
183183
VWERASE: Final[int]
184184

185185
if sys.version_info >= (3, 13):
186+
B14400: Final[int]
187+
B28800: Final[int]
188+
B7200: Final[int]
189+
B76800: Final[int]
186190
EXTPROC: Final[int]
187191
IUTF8: Final[int]
188192

189193
if sys.platform == "darwin" and sys.version_info >= (3, 13):
190194
ALTWERASE: Final[int]
191-
B14400: Final[int]
192-
B28800: Final[int]
193-
B7200: Final[int]
194-
B76800: Final[int]
195195
CCAR_OFLOW: Final[int]
196196
CCTS_OFLOW: Final[int]
197197
CDSR_OFLOW: Final[int]
@@ -274,6 +274,7 @@ if sys.platform != "win32":
274274
B460800: Final[int]
275275
B500000: Final[int]
276276
B921600: Final[int]
277+
IBSHIFT: Final[int]
277278

278279
if sys.platform != "linux":
279280
TCSASOFT: Final[int]
@@ -286,7 +287,6 @@ if sys.platform != "win32":
286287
CNUL: Final[int]
287288
COMMON: Final[int]
288289
CSWTCH: Final[int]
289-
IBSHIFT: Final[int]
290290
INIT_C_CC: Final[int]
291291
NSWTCH: Final[int]
292292

0 commit comments

Comments
 (0)