diff --git a/stubs/cffi/@tests/stubtest_allowlist.txt b/stubs/cffi/@tests/stubtest_allowlist.txt index 8884550884fe..7a2812d7f4f3 100644 --- a/stubs/cffi/@tests/stubtest_allowlist.txt +++ b/stubs/cffi/@tests/stubtest_allowlist.txt @@ -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 @@ -11,4 +8,4 @@ cffi.vengine_cpy.__warningregistry__ # Unnecessary re-exports cffi.cparser.COMMON_TYPES -cffi.verifier.__version_verifier_modules__ \ No newline at end of file +cffi.verifier.__version_verifier_modules__ diff --git a/stubs/cffi/@tests/stubtest_allowlist_darwin.txt b/stubs/cffi/@tests/stubtest_allowlist_darwin.txt new file mode 100644 index 000000000000..55d4b889aca9 --- /dev/null +++ b/stubs/cffi/@tests/stubtest_allowlist_darwin.txt @@ -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 diff --git a/stubs/cffi/@tests/stubtest_allowlist_linux.txt b/stubs/cffi/@tests/stubtest_allowlist_linux.txt new file mode 100644 index 000000000000..55d4b889aca9 --- /dev/null +++ b/stubs/cffi/@tests/stubtest_allowlist_linux.txt @@ -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 diff --git a/stubs/cffi/METADATA.toml b/stubs/cffi/METADATA.toml index 0857c7852e9d..1c348f18b83c 100644 --- a/stubs/cffi/METADATA.toml +++ b/stubs/cffi/METADATA.toml @@ -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"] diff --git a/stubs/cffi/_cffi_backend.pyi b/stubs/cffi/_cffi_backend.pyi index ecee297fdf7e..05d12ff35a7a 100644 --- a/stubs/cffi/_cffi_backend.pyi +++ b/stubs/cffi/_cffi_backend.pyi @@ -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 diff --git a/stubs/cffi/cffi/api.pyi b/stubs/cffi/cffi/api.pyi index 751f7d1fddbf..2c929dd65853 100644 --- a/stubs/cffi/cffi/api.pyi +++ b/stubs/cffi/cffi/api.pyi @@ -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: ...