]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Update `pycurl` annotations compatibility 3638/head
authorPsychosoc1al <tohichpetrov@gmail.com>
Wed, 17 Jun 2026 15:54:47 +0000 (18:54 +0300)
committerPsychosoc1al <tohichpetrov@gmail.com>
Wed, 17 Jun 2026 16:04:47 +0000 (19:04 +0300)
tornado/curl_httpclient.py

index 98da8543cc904c157f6e1df1c2e7b0b7a46d6d22..06c75fe300f9e607d6ff59999295fb10b9d65fe0 100644 (file)
@@ -49,8 +49,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
         self, max_clients: int = 10, defaults: dict[str, Any] | None = None
     ) -> None:
         super().initialize(defaults=defaults)
-        # Typeshed is incomplete for CurlMulti, so just use Any for now.
-        self._multi: Any = pycurl.CurlMulti()
+        self._multi = pycurl.CurlMulti()
         self._multi.setopt(pycurl.M_TIMERFUNCTION, self._set_timeout)
         self._multi.setopt(pycurl.M_SOCKETFUNCTION, self._handle_socket)
         self._curls = [self._curl_create() for i in range(max_clients)]
@@ -81,7 +80,7 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
         # Set below properties to None to reduce the reference count of current
         # instance, because those properties hold some methods of current
         # instance that will case circular reference.
-        self._multi = None
+        self._multi = None  # type: ignore
 
     def fetch_impl(
         self, request: HTTPRequest, callback: Callable[[HTTPResponse], None]
@@ -90,7 +89,9 @@ class CurlAsyncHTTPClient(AsyncHTTPClient):
         self._process_queue()
         self._set_timeout(0)
 
-    def _handle_socket(self, event: int, fd: int, multi: Any, data: bytes) -> None:
+    def _handle_socket(
+        self, event: int, fd: int, multi: pycurl.CurlMulti, data: Any | None
+    ) -> None:
         """Called by libcurl when it wants to change the file descriptors
         it cares about.
         """