From 768325d8df3a191265b6eacec2a5361454e2838d Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Wed, 29 Apr 2026 09:38:50 +0200 Subject: [PATCH 1/2] [cffi] Fix `FFI.new`'s `init` arg is now Any. Same as _cffi_backend.pyi's declaration --- stubs/cffi/cffi/api.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stubs/cffi/cffi/api.pyi b/stubs/cffi/cffi/api.pyi index 22ba59fdd624..eed2a82dade3 100644 --- a/stubs/cffi/cffi/api.pyi +++ b/stubs/cffi/cffi/api.pyi @@ -36,7 +36,10 @@ class FFI: def sizeof(self, cdecl: str | CData) -> int: ... def alignof(self, cdecl: str | CData) -> int: ... def offsetof(self, cdecl: str | CData, *fields_or_indexes: str | int) -> int: ... - def new(self, cdecl: str | CType, init=None) -> CData: ... + + # The acceptable types of `init` depend on the value of `cdecl` only known at runtime, and + # therfore unknown to the type checker. + def new(self, cdecl: str | CType, init: Any = None) -> CData: ... def new_allocator( self, alloc: Callable[[int], CData] | None = None, From 30c3a9c6c690e7a70acb56132659d1a47d4b8077 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sun, 3 May 2026 15:17:29 -0700 Subject: [PATCH 2/2] Apply suggestion from @JelleZijlstra --- stubs/cffi/cffi/api.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/cffi/cffi/api.pyi b/stubs/cffi/cffi/api.pyi index eed2a82dade3..ffcc539f94b2 100644 --- a/stubs/cffi/cffi/api.pyi +++ b/stubs/cffi/cffi/api.pyi @@ -38,7 +38,7 @@ class FFI: def offsetof(self, cdecl: str | CData, *fields_or_indexes: str | int) -> int: ... # The acceptable types of `init` depend on the value of `cdecl` only known at runtime, and - # therfore unknown to the type checker. + # therefore unknown to the type checker. def new(self, cdecl: str | CType, init: Any = None) -> CData: ... def new_allocator( self,