Skip to content

Commit 9e79a10

Browse files
authored
Add os.splice and flags on Linux for Python 3.10+ (#10771)
1 parent a0b2583 commit 9e79a10

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

stdlib/os/__init__.pyi

+11
Original file line numberDiff line numberDiff line change
@@ -1062,9 +1062,20 @@ if sys.version_info >= (3, 10) and sys.platform == "linux":
10621062
EFD_CLOEXEC: int
10631063
EFD_NONBLOCK: int
10641064
EFD_SEMAPHORE: int
1065+
SPLICE_F_MORE: int
1066+
SPLICE_F_MOVE: int
1067+
SPLICE_F_NONBLOCK: int
10651068
def eventfd(initval: int, flags: int = 524288) -> FileDescriptor: ...
10661069
def eventfd_read(fd: FileDescriptor) -> int: ...
10671070
def eventfd_write(fd: FileDescriptor, value: int) -> None: ...
1071+
def splice(
1072+
src: FileDescriptor,
1073+
dst: FileDescriptor,
1074+
count: int,
1075+
offset_src: int | None = ...,
1076+
offset_dst: int | None = ...,
1077+
flags: int = 0,
1078+
) -> int: ...
10681079

10691080
if sys.version_info >= (3, 12) and sys.platform == "linux":
10701081
CLONE_FILES: int

stdlib/posix.pyi

+4
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,13 @@ if sys.platform != "win32":
242242
EFD_CLOEXEC as EFD_CLOEXEC,
243243
EFD_NONBLOCK as EFD_NONBLOCK,
244244
EFD_SEMAPHORE as EFD_SEMAPHORE,
245+
SPLICE_F_MORE as SPLICE_F_MORE,
246+
SPLICE_F_MOVE as SPLICE_F_MOVE,
247+
SPLICE_F_NONBLOCK as SPLICE_F_NONBLOCK,
245248
eventfd as eventfd,
246249
eventfd_read as eventfd_read,
247250
eventfd_write as eventfd_write,
251+
splice as splice,
248252
)
249253
else:
250254
from os import chflags as chflags, lchflags as lchflags, lchmod as lchmod

tests/stubtest_allowlists/linux-py310.txt

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
_?curses.color_pair
2-
(os|posix).SPLICE_F_MORE
3-
(os|posix).SPLICE_F_MOVE
4-
(os|posix).SPLICE_F_NONBLOCK
52
(os|posix).setresgid
63
(os|posix).setresuid
74
(os|posix).sendfile
8-
(os|posix).splice
95
signal.sigtimedwait
106
signal.sigwaitinfo
117

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
_?curses.color_pair
22
mmap.MAP_STACK
3-
(os|posix).SPLICE_F_MORE
4-
(os|posix).SPLICE_F_MOVE
5-
(os|posix).SPLICE_F_NONBLOCK
63
(os|posix).setresgid
74
(os|posix).setresuid
85
(os|posix).sendfile
9-
(os|posix).splice
106
signal.sigtimedwait
117
signal.sigwaitinfo
128
xxlimited.Xxo.x_exports

tests/stubtest_allowlists/linux-py312.txt

-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ _posixsubprocess.fork_exec
44
(os|posix).setns
55
(os|posix).setresgid
66
(os|posix).setresuid
7-
(os|posix).splice
8-
(os|posix).SPLICE_F_MORE
9-
(os|posix).SPLICE_F_MOVE
10-
(os|posix).SPLICE_F_NONBLOCK
117
fcntl.FICLONE
128
fcntl.FICLONERANGE
139
mmap.MAP_STACK

0 commit comments

Comments
 (0)