From 8dc28eb310a3ae1ccb2b57dafe8681e3d7b4f84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 27 Oct 2025 19:11:20 +0200 Subject: [PATCH 1/2] Annotate pycurl's getinfo() and getinfo_raw() getinfo and getinfo_raw docs: http://pycurl.io/docs/latest/curlobject.html#pycurl.Curl.getinfo --- stubs/pycurl/pycurl.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index 36a44e6ecbe2..fced71d4501d 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -1,5 +1,6 @@ import sys from _typeshed import Incomplete +from collections.abc import Sequence from typing import Final, final from typing_extensions import Self @@ -22,8 +23,8 @@ class Curl: def perform(self) -> None: ... def perform_rb(self) -> bytes: ... def perform_rs(self) -> str: ... - def getinfo(self, info): ... - def getinfo_raw(self, info): ... + def getinfo(self, info: int) -> int | float | str | list[str] | list[Sequence[tuple[str, str]]]: ... + def getinfo_raw(self, info: int) -> int | float | bytes | list[bytes] | list[Sequence[tuple[bytes, bytes]]]: ... def reset(self) -> None: ... def unsetopt(self, option: int): ... def pause(self, bitmask): ... From c6a84d2b64db962e01662c70882d46c8a5654016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Fri, 31 Oct 2025 17:23:18 +0200 Subject: [PATCH 2/2] Change the return value to Any --- stubs/pycurl/pycurl.pyi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index fced71d4501d..f5920dd8564a 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -1,7 +1,6 @@ import sys from _typeshed import Incomplete -from collections.abc import Sequence -from typing import Final, final +from typing import Any, Final, final from typing_extensions import Self version: str @@ -23,8 +22,10 @@ class Curl: def perform(self) -> None: ... def perform_rb(self) -> bytes: ... def perform_rs(self) -> str: ... - def getinfo(self, info: int) -> int | float | str | list[str] | list[Sequence[tuple[str, str]]]: ... - def getinfo_raw(self, info: int) -> int | float | bytes | list[bytes] | list[Sequence[tuple[bytes, bytes]]]: ... + # For getinfo and getinfo_raw, the exact return type depends on the passed value: + # http://pycurl.io/docs/latest/curlobject.html#pycurl.Curl.getinfo + def getinfo(self, info: int) -> Any: ... + def getinfo_raw(self, info: int) -> Any: ... def reset(self) -> None: ... def unsetopt(self, option: int): ... def pause(self, bitmask): ...