Skip to content

Commit 00c0c8d

Browse files
authored
cleaning up termios constants (#13138)
1 parent 93a31af commit 00c0c8d

File tree

3 files changed

+112
-76
lines changed

3 files changed

+112
-76
lines changed

stdlib/@tests/stubtest_allowlists/darwin.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ select.POLLMSG # system dependent
1919
(fcntl.F_SETLEASE)?
2020
(_gdbm)?
2121

22-
# Platform differences that cannot be captured by the type system
23-
(termios.[A-Z0-9_]+)?
24-
2522
# ==========
2623
# Allowlist entries that cannot or should not be fixed
2724
# ==========

stdlib/@tests/stubtest_allowlists/linux.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ multiprocessing.popen_spawn_win32
2525

2626
# Platform differences that cannot be captured by the type system
2727
fcntl.I_[A-Z0-9_]+
28-
(termios.[A-Z0-9_]+)?
2928

3029
# Some of these exist on non-windows, but they are useless and this is not intended
3130
stat.FILE_ATTRIBUTE_[A-Z_]+
@@ -66,3 +65,7 @@ _?socket.SOL_HCI
6665
_?socket.SOL_IPX
6766
_?socket.SOL_NETROM
6867
_?socket.SOL_ROSE
68+
69+
# This is available on Linux, but it's documented as for kernel debugging and
70+
# not present on GitHub Actions runners.
71+
termios.TIOCTTYGSTRUCT

stdlib/termios.pyi

Lines changed: 108 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,38 @@ _AttrReturn: TypeAlias = list[Any]
1010

1111
if sys.platform != "win32":
1212
B0: int
13-
B1000000: int
1413
B110: int
1514
B115200: int
16-
B1152000: int
1715
B1200: int
1816
B134: int
1917
B150: int
20-
B1500000: int
2118
B1800: int
2219
B19200: int
2320
B200: int
24-
B2000000: int
2521
B230400: int
2622
B2400: int
27-
B2500000: int
2823
B300: int
29-
B3000000: int
30-
B3500000: int
3124
B38400: int
32-
B4000000: int
33-
B460800: int
3425
B4800: int
3526
B50: int
36-
B500000: int
3727
B57600: int
38-
B576000: int
3928
B600: int
4029
B75: int
41-
B921600: int
4230
B9600: int
4331
BRKINT: int
4432
BS0: int
4533
BS1: int
4634
BSDLY: int
47-
CBAUD: int
48-
CBAUDEX: int
49-
CDEL: int
5035
CDSUSP: int
5136
CEOF: int
5237
CEOL: int
53-
CEOL2: int
5438
CEOT: int
5539
CERASE: int
56-
CESC: int
5740
CFLUSH: int
58-
CIBAUD: int
5941
CINTR: int
6042
CKILL: int
6143
CLNEXT: int
6244
CLOCAL: int
63-
CNUL: int
64-
COMMON: int
6545
CQUIT: int
6646
CR0: int
6747
CR1: int
@@ -80,7 +60,6 @@ if sys.platform != "win32":
8060
CSTOP: int
8161
CSTOPB: int
8262
CSUSP: int
83-
CSWTCH: int
8463
CWERASE: int
8564
ECHO: int
8665
ECHOCTL: int
@@ -101,41 +80,28 @@ if sys.platform != "win32":
10180
FIONREAD: int
10281
FLUSHO: int
10382
HUPCL: int
104-
IBSHIFT: int
10583
ICANON: int
10684
ICRNL: int
10785
IEXTEN: int
10886
IGNBRK: int
10987
IGNCR: int
11088
IGNPAR: int
11189
IMAXBEL: int
112-
INIT_C_CC: int
11390
INLCR: int
11491
INPCK: int
115-
IOCSIZE_MASK: int
116-
IOCSIZE_SHIFT: int
11792
ISIG: int
11893
ISTRIP: int
119-
IUCLC: int
12094
IXANY: int
12195
IXOFF: int
12296
IXON: int
123-
N_MOUSE: int
124-
N_PPP: int
125-
N_SLIP: int
126-
N_STRIP: int
127-
N_TTY: int
128-
NCC: int
12997
NCCS: int
13098
NL0: int
13199
NL1: int
132100
NLDLY: int
133101
NOFLSH: int
134-
NSWTCH: int
135102
OCRNL: int
136103
OFDEL: int
137104
OFILL: int
138-
OLCUC: int
139105
ONLCR: int
140106
ONLRET: int
141107
ONOCR: int
@@ -149,9 +115,6 @@ if sys.platform != "win32":
149115
TAB2: int
150116
TAB3: int
151117
TABDLY: int
152-
TCFLSH: int
153-
TCGETA: int
154-
TCGETS: int
155118
TCIFLUSH: int
156119
TCIOFF: int
157120
TCIOFLUSH: int
@@ -162,28 +125,11 @@ if sys.platform != "win32":
162125
TCSADRAIN: int
163126
TCSAFLUSH: int
164127
TCSANOW: int
165-
TCSASOFT: int
166-
TCSBRK: int
167-
TCSBRKP: int
168-
TCSETA: int
169-
TCSETAF: int
170-
TCSETAW: int
171-
TCSETS: int
172-
TCSETSF: int
173-
TCSETSW: int
174-
TCXONC: int
175128
TIOCCONS: int
176129
TIOCEXCL: int
177130
TIOCGETD: int
178-
TIOCGICOUNT: int
179-
TIOCGLCKTRMIOS: int
180131
TIOCGPGRP: int
181-
TIOCGSERIAL: int
182-
TIOCGSIZE: int
183-
TIOCGSOFTCAR: int
184132
TIOCGWINSZ: int
185-
TIOCINQ: int
186-
TIOCLINUX: int
187133
TIOCM_CAR: int
188134
TIOCM_CD: int
189135
TIOCM_CTS: int
@@ -198,7 +144,6 @@ if sys.platform != "win32":
198144
TIOCMBIC: int
199145
TIOCMBIS: int
200146
TIOCMGET: int
201-
TIOCMIWAIT: int
202147
TIOCMSET: int
203148
TIOCNOTTY: int
204149
TIOCNXCL: int
@@ -212,23 +157,10 @@ if sys.platform != "win32":
212157
TIOCPKT_STOP: int
213158
TIOCPKT: int
214159
TIOCSCTTY: int
215-
TIOCSER_TEMT: int
216-
TIOCSERCONFIG: int
217-
TIOCSERGETLSR: int
218-
TIOCSERGETMULTI: int
219-
TIOCSERGSTRUCT: int
220-
TIOCSERGWILD: int
221-
TIOCSERSETMULTI: int
222-
TIOCSERSWILD: int
223160
TIOCSETD: int
224-
TIOCSLCKTRMIOS: int
225161
TIOCSPGRP: int
226-
TIOCSSERIAL: int
227-
TIOCSSIZE: int
228-
TIOCSSOFTCAR: int
229162
TIOCSTI: int
230163
TIOCSWINSZ: int
231-
TIOCTTYGSTRUCT: int
232164
TOSTOP: int
233165
VDISCARD: int
234166
VEOF: int
@@ -244,15 +176,119 @@ if sys.platform != "win32":
244176
VSTART: int
245177
VSTOP: int
246178
VSUSP: int
247-
VSWTC: int
248-
VSWTCH: int
249179
VT0: int
250180
VT1: int
251181
VTDLY: int
252182
VTIME: int
253183
VWERASE: int
254-
XCASE: int
255-
XTABS: int
184+
185+
if sys.version_info >= (3, 13):
186+
EXTPROC: int
187+
IUTF8: int
188+
189+
if sys.platform == "darwin" and sys.version_info >= (3, 13):
190+
ALTWERASE: int
191+
B14400: int
192+
B28800: int
193+
B7200: int
194+
B76800: int
195+
CCAR_OFLOW: int
196+
CCTS_OFLOW: int
197+
CDSR_OFLOW: int
198+
CDTR_IFLOW: int
199+
CIGNORE: int
200+
CRTS_IFLOW: int
201+
MDMBUF: int
202+
NL2: int
203+
NL3: int
204+
NOKERNINFO: int
205+
ONOEOT: int
206+
OXTABS: int
207+
VDSUSP: int
208+
VSTATUS: int
209+
210+
if sys.platform == "darwin" and sys.version_info >= (3, 11):
211+
TIOCGSIZE: int
212+
TIOCSSIZE: int
213+
214+
if sys.platform == "linux":
215+
B1152000: int
216+
B576000: int
217+
CBAUD: int
218+
CBAUDEX: int
219+
CIBAUD: int
220+
IOCSIZE_MASK: int
221+
IOCSIZE_SHIFT: int
222+
IUCLC: int
223+
N_MOUSE: int
224+
N_PPP: int
225+
N_SLIP: int
226+
N_STRIP: int
227+
N_TTY: int
228+
NCC: int
229+
OLCUC: int
230+
TCFLSH: int
231+
TCGETA: int
232+
TCGETS: int
233+
TCSBRK: int
234+
TCSBRKP: int
235+
TCSETA: int
236+
TCSETAF: int
237+
TCSETAW: int
238+
TCSETS: int
239+
TCSETSF: int
240+
TCSETSW: int
241+
TCXONC: int
242+
TIOCGICOUNT: int
243+
TIOCGLCKTRMIOS: int
244+
TIOCGSERIAL: int
245+
TIOCGSOFTCAR: int
246+
TIOCINQ: int
247+
TIOCLINUX: int
248+
TIOCMIWAIT: int
249+
TIOCTTYGSTRUCT: int
250+
TIOCSER_TEMT: int
251+
TIOCSERCONFIG: int
252+
TIOCSERGETLSR: int
253+
TIOCSERGETMULTI: int
254+
TIOCSERGSTRUCT: int
255+
TIOCSERGWILD: int
256+
TIOCSERSETMULTI: int
257+
TIOCSERSWILD: int
258+
TIOCSLCKTRMIOS: int
259+
TIOCSSERIAL: int
260+
TIOCSSOFTCAR: int
261+
VSWTC: int
262+
VSWTCH: int
263+
XCASE: int
264+
XTABS: int
265+
266+
if sys.platform != "darwin":
267+
B1000000: int
268+
B1500000: int
269+
B2000000: int
270+
B2500000: int
271+
B3000000: int
272+
B3500000: int
273+
B4000000: int
274+
B460800: int
275+
B500000: int
276+
B921600: int
277+
278+
if sys.platform != "linux":
279+
TCSASOFT: int
280+
281+
if sys.platform != "darwin" and sys.platform != "linux":
282+
# not available on FreeBSD either.
283+
CDEL: int
284+
CEOL2: int
285+
CESC: int
286+
CNUL: int
287+
COMMON: int
288+
CSWTCH: int
289+
IBSHIFT: int
290+
INIT_C_CC: int
291+
NSWTCH: int
256292

257293
def tcgetattr(fd: FileDescriptorLike, /) -> _AttrReturn: ...
258294
def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr, /) -> None: ...

0 commit comments

Comments
 (0)