From 084f555793448d5ce5325d4871b5e33b7cdc29ba Mon Sep 17 00:00:00 2001 From: ankm20 <72892644+ankm20@users.noreply.github.com> Date: Thu, 13 Apr 2023 02:28:21 -0700 Subject: [PATCH] [cffi] dlopen(None) works when platform != win32 (#10042) --- stubs/cffi/cffi/api.pyi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stubs/cffi/cffi/api.pyi b/stubs/cffi/cffi/api.pyi index e3ae14188..770751128 100644 --- a/stubs/cffi/cffi/api.pyi +++ b/stubs/cffi/cffi/api.pyi @@ -25,7 +25,12 @@ class FFI: def __init__(self, backend: types.ModuleType | None = None) -> None: ... def cdef(self, csource: str, override: bool = False, packed: bool = False, pack: int | None = None) -> None: ... def embedding_api(self, csource: str, packed: bool = False, pack: bool | int | None = None) -> None: ... - def dlopen(self, name: str, flags: int = 0) -> _cffi_backend.Lib: ... + + if sys.platform == "win32": + def dlopen(self, name: str, flags: int = ...) -> _cffi_backend.Lib: ... + else: + def dlopen(self, name: str | None, flags: int = ...) -> _cffi_backend.Lib: ... + def dlclose(self, lib: _cffi_backend.Lib) -> None: ... def typeof(self, cdecl: str | CData | types.BuiltinFunctionType | types.FunctionType) -> CType: ... def sizeof(self, cdecl: str | CData) -> int: ...