diff --git a/pygit2/_libgit2/ffi.pyi b/pygit2/_libgit2/ffi.pyi index 0e865e31..08bc4196 100644 --- a/pygit2/_libgit2/ffi.pyi +++ b/pygit2/_libgit2/ffi.pyi @@ -329,6 +329,8 @@ def new(a: Literal['git_buf *'], b: tuple[NULL_TYPE, Literal[0]]) -> GitBufC: .. @overload def new(a: Literal['char **']) -> _Pointer[char_pointer]: ... @overload +def new(a: Literal['void **'], b: bytes) -> _Pointer[bytes]: ... +@overload def new(a: Literal['char[]', 'char []'], b: bytes | NULL_TYPE) -> ArrayC[char]: ... def addressof(a: object, attribute: str) -> _Pointer[object]: ... diff --git a/pygit2/config.py b/pygit2/config.py index 76d114fe..f05a8d13 100644 --- a/pygit2/config.py +++ b/pygit2/config.py @@ -110,7 +110,7 @@ def __del__(self) -> None: except AttributeError: pass - def _get(self, key: str | bytes) -> tuple[object, 'ConfigEntry']: + def _get(self, key: str | bytes) -> tuple[int, 'ConfigEntry']: key = str_to_bytes(key, 'key') entry = ffi.new('git_config_entry **') diff --git a/pygit2/errors.py b/pygit2/errors.py index 72a4af39..00108e32 100644 --- a/pygit2/errors.py +++ b/pygit2/errors.py @@ -32,7 +32,7 @@ value_errors = set([C.GIT_EEXISTS, C.GIT_EINVALIDSPEC, C.GIT_EAMBIGUOUS]) -def check_error(err, io=False): +def check_error(err: int, io=False) -> None: if err >= 0: return diff --git a/pygit2/utils.py b/pygit2/utils.py index b3d5d141..bdc6dfe4 100644 --- a/pygit2/utils.py +++ b/pygit2/utils.py @@ -93,7 +93,7 @@ def to_str(s): raise TypeError(f'unexpected type "{repr(s)}"') -def ptr_to_bytes(ptr_cdata): +def ptr_to_bytes(ptr_cdata) -> bytes: """ Convert a pointer coming from C code () to a byte buffer containing the address that the pointer refers to.