Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all constants in fcntl are available on macos #6807

Merged
merged 10 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 76 additions & 56 deletions stdlib/fcntl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,80 +6,100 @@ from typing_extensions import Literal
if sys.platform != "win32":
FASYNC: int
FD_CLOEXEC: int
DN_ACCESS: int
DN_ATTRIB: int
DN_CREATE: int
DN_DELETE: int
DN_MODIFY: int
DN_MULTISHOT: int
DN_RENAME: int
F_DUPFD: int
F_DUPFD_CLOEXEC: int
F_FULLFSYNC: int
F_EXLCK: int
F_GETFD: int
F_GETFL: int
F_GETLEASE: int
F_GETLK: int
F_GETLK64: int
F_GETOWN: int
F_NOCACHE: int
F_GETSIG: int
F_NOTIFY: int
F_RDLCK: int
F_SETFD: int
F_SETFL: int
F_SETLEASE: int
F_SETLK: int
F_SETLK64: int
F_SETLKW: int
F_SETLKW64: int
if sys.version_info >= (3, 9) and sys.platform == "linux":
F_OFD_GETLK: int
F_OFD_SETLK: int
F_OFD_SETLKW: int
F_SETOWN: int
F_SETSIG: int
F_SHLCK: int
F_UNLCK: int
F_WRLCK: int
I_ATMARK: int
I_CANPUT: int
I_CKBAND: int
I_FDINSERT: int
I_FIND: int
I_FLUSH: int
I_FLUSHBAND: int
I_GETBAND: int
I_GETCLTIME: int
I_GETSIG: int
I_GRDOPT: int
I_GWROPT: int
I_LINK: int
I_LIST: int
I_LOOK: int
I_NREAD: int
I_PEEK: int
I_PLINK: int
I_POP: int
I_PUNLINK: int
I_PUSH: int
I_RECVFD: int
I_SENDFD: int
I_SETCLTIME: int
I_SETSIG: int
I_SRDOPT: int
I_STR: int
I_SWROPT: int
I_UNLINK: int
if sys.platform == "darwin":
F_FULLFSYNC: int
F_NOCACHE: int
if sys.version_info >= (3, 9):
F_GETPATH: int
if sys.platform == "linux":
F_SETLKW64: int
F_SETSIG: int
F_SHLCK: int
F_SETLK64: int
F_SETLEASE: int
F_GETSIG: int
F_NOTIFY: int
F_EXLCK: int
F_GETLEASE: int
F_GETLK64: int
if sys.version_info >= (3, 8):
F_ADD_SEALS: int
F_GET_SEALS: int
F_SEAL_GROW: int
F_SEAL_SEAL: int
F_SEAL_SHRINK: int
F_SEAL_WRITE: int
if sys.version_info >= (3, 9):
F_OFD_GETLK: int
F_OFD_SETLK: int
F_OFD_SETLKW: int
if sys.version_info >= (3, 10):
F_GETPIPE_SZ: int
F_SETPIPE_SZ: int

DN_ACCESS: int
DN_ATTRIB: int
DN_CREATE: int
DN_DELETE: int
DN_MODIFY: int
DN_MULTISHOT: int
DN_RENAME: int

LOCK_EX: int
LOCK_MAND: int
LOCK_NB: int
LOCK_READ: int
LOCK_RW: int
LOCK_SH: int
LOCK_UN: int
LOCK_WRITE: int
if sys.platform == "linux":
LOCK_MAND: int
LOCK_READ: int
LOCK_RW: int
LOCK_WRITE: int

# These are highly problematic, they might be present or not, depends on the specific OS.
if sys.platform == "linux":
I_ATMARK: int
I_CANPUT: int
I_CKBAND: int
I_FDINSERT: int
I_FIND: int
I_FLUSH: int
I_FLUSHBAND: int
I_GETBAND: int
I_GETCLTIME: int
I_GETSIG: int
I_GRDOPT: int
I_GWROPT: int
I_LINK: int
I_LIST: int
I_LOOK: int
I_NREAD: int
I_PEEK: int
I_PLINK: int
I_POP: int
I_PUNLINK: int
I_PUSH: int
I_RECVFD: int
I_SENDFD: int
I_SETCLTIME: int
I_SETSIG: int
I_SRDOPT: int
I_STR: int
I_SWROPT: int
I_UNLINK: int
@overload
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = ...) -> int: ...
@overload
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ ossaudiodev
spwd

# Platform differences that cannot be captured by the type system
fcntl.[A-Z0-9_]+
os.SCHED_[A-Z_]+
posix.SCHED_[A-Z_]+

Expand Down
2 changes: 1 addition & 1 deletion tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ posix.error.characters_written
resource.error.characters_written

# Platform differences that cannot be captured by the type system
fcntl.[A-Z0-9_]+
fcntl.I_[A-Z0-9_]+
os.SCHED_[A-Z_]+
posix.SCHED_[A-Z_]+

Expand Down