Skip to content

Commit

Permalink
cffi: run stubtest on Windows (#9178)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 12, 2022
1 parent f033e61 commit 7fc9b8e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
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

0 comments on commit 7fc9b8e

Please sign in to comment.