From 611a63ab3c31a1fa8b3328e3af3e4eee27d88d18 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 12 Nov 2022 15:18:38 -0500 Subject: [PATCH 1/2] Run cffi on windows --- stubs/cffi/@tests/stubtest_allowlist.txt | 5 +---- stubs/cffi/@tests/stubtest_allowlist_darwin.txt | 2 ++ stubs/cffi/@tests/stubtest_allowlist_linux.txt | 2 ++ stubs/cffi/METADATA.toml | 2 ++ stubs/cffi/cffi/api.pyi | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 stubs/cffi/@tests/stubtest_allowlist_darwin.txt create mode 100644 stubs/cffi/@tests/stubtest_allowlist_linux.txt 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..31e3adeb657d 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 equivalent +platforms = ["linux", "win32"] 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: ... From 862154e0d5949f0cd7ba8f53027efbf1addc3e6a Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 12 Nov 2022 15:36:38 -0500 Subject: [PATCH 2/2] RTLD_DEEPBIND --- stubs/cffi/METADATA.toml | 2 +- stubs/cffi/_cffi_backend.pyi | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stubs/cffi/METADATA.toml b/stubs/cffi/METADATA.toml index 31e3adeb657d..1c348f18b83c 100644 --- a/stubs/cffi/METADATA.toml +++ b/stubs/cffi/METADATA.toml @@ -2,5 +2,5 @@ version = "1.15.*" [tool.stubtest] ignore_missing_stub = false -# linux and darwin are equivalent +# 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