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

cffi: run stubtest on Windows #9178

Merged
merged 2 commits into from
Nov 12, 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
5 changes: 1 addition & 4 deletions stubs/cffi/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# technically exists on all OSs, but crashes on all but windows
cffi.(api.)?FFI.getwinerror

# added dynamically and not detected by stubtest
cffi.(api.)?FFI.CData
cffi.(api.)?FFI.CType
Expand All @@ -11,4 +8,4 @@ cffi.vengine_cpy.__warningregistry__

# Unnecessary re-exports
cffi.cparser.COMMON_TYPES
cffi.verifier.__version_verifier_modules__
cffi.verifier.__version_verifier_modules__
2 changes: 2 additions & 0 deletions stubs/cffi/@tests/stubtest_allowlist_darwin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs
cffi.(api.)?FFI.getwinerror
2 changes: 2 additions & 0 deletions stubs/cffi/@tests/stubtest_allowlist_linux.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs
cffi.(api.)?FFI.getwinerror
2 changes: 2 additions & 0 deletions stubs/cffi/METADATA.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ version = "1.15.*"

[tool.stubtest]
ignore_missing_stub = false
# linux and darwin are mostly equivalent, except for a single `RTLD_DEEPBIND` variable
platforms = ["linux", "win32"]
3 changes: 2 additions & 1 deletion stubs/cffi/_cffi_backend.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ RTLD_GLOBAL: int
RTLD_LAZY: int
RTLD_LOCAL: int
RTLD_NOW: int
if sys.platform != "win32":
if sys.platform == "linux":
RTLD_DEEPBIND: int
if sys.platform != "win32":
RTLD_NODELETE: int
RTLD_NOLOAD: int

Expand Down
1 change: 1 addition & 0 deletions stubs/cffi/cffi/api.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class FFI:
@overload
def gc(self, cdata: CData, destructor: None, size: int = ...) -> None: ...
def verify(self, source: str = ..., tmpdir: str | None = ..., **kwargs: Any) -> _cffi_backend.Lib: ...
# Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs
if sys.platform == "win32":
def getwinerror(self, code: int = ...) -> tuple[int, str] | None: ...

Expand Down