Skip to content

Commit 3838468

Browse files
authored
Add fcntl.F_DUPFD_QUERY on Linux (#16436)
Python 3.14 exposes `F_DUPFD_QUERY` in `fcntl` on Linux, but the stub did not declare it, so type checkers rejected its use. - Declare it for Python 3.14 and later on Linux - Allowlist it as optional for stubtest, since the GitHub Actions runners build against a glibc that lacks the macro
1 parent 249fa03 commit 3838468

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ curses.COLOR_PAIRS # Initialized after start_color
2323
curses.COLS # Initialized only after initscr call
2424
curses.LINES # Initialized only after initscr call
2525
fcntl.I_[A-Z0-9_]+ # Platform differences that cannot be captured by the type system
26+
(fcntl.F_DUPFD_QUERY)? # Depends on the glibc version Python was built against
2627
multiprocessing.popen_spawn_win32 # exists on Linux but fails to import
2728
select.poll # Actually a function; we have a class so it can be used as a type
2829

‎stdlib/fcntl.pyi‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ if sys.platform != "win32":
121121
RWH_WRITE_LIFE_LONG: Final = 4
122122
RWH_WRITE_LIFE_EXTREME: Final = 5
123123

124+
if sys.version_info >= (3, 14) and sys.platform == "linux":
125+
F_DUPFD_QUERY: Final[int]
126+
124127
if sys.version_info >= (3, 11) and sys.platform == "darwin":
125128
F_OFD_SETLK: Final = 90
126129
F_OFD_SETLKW: Final = 91

0 commit comments

Comments
 (0)