Skip to content

Commit 7fc9b8e

Browse files
authored
cffi: run stubtest on Windows (#9178)
1 parent f033e61 commit 7fc9b8e

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# technically exists on all OSs, but crashes on all but windows
2-
cffi.(api.)?FFI.getwinerror
3-
41
# added dynamically and not detected by stubtest
52
cffi.(api.)?FFI.CData
63
cffi.(api.)?FFI.CType
@@ -11,4 +8,4 @@ cffi.vengine_cpy.__warningregistry__
118

129
# Unnecessary re-exports
1310
cffi.cparser.COMMON_TYPES
14-
cffi.verifier.__version_verifier_modules__
11+
cffi.verifier.__version_verifier_modules__
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs
2+
cffi.(api.)?FFI.getwinerror
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs
2+
cffi.(api.)?FFI.getwinerror

stubs/cffi/METADATA.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ version = "1.15.*"
22

33
[tool.stubtest]
44
ignore_missing_stub = false
5+
# linux and darwin are mostly equivalent, except for a single `RTLD_DEEPBIND` variable
6+
platforms = ["linux", "win32"]

stubs/cffi/_cffi_backend.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ RTLD_GLOBAL: int
1818
RTLD_LAZY: int
1919
RTLD_LOCAL: int
2020
RTLD_NOW: int
21-
if sys.platform != "win32":
21+
if sys.platform == "linux":
2222
RTLD_DEEPBIND: int
23+
if sys.platform != "win32":
2324
RTLD_NODELETE: int
2425
RTLD_NOLOAD: int
2526

stubs/cffi/cffi/api.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class FFI:
7272
@overload
7373
def gc(self, cdata: CData, destructor: None, size: int = ...) -> None: ...
7474
def verify(self, source: str = ..., tmpdir: str | None = ..., **kwargs: Any) -> _cffi_backend.Lib: ...
75+
# Technically exists on all OSs, but crashes on all but Windows. So we hide it in stubs
7576
if sys.platform == "win32":
7677
def getwinerror(self, code: int = ...) -> tuple[int, str] | None: ...
7778

0 commit comments

Comments
 (0)