Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tornado/curl_httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ def initialize( # type: ignore
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)]
Expand Down Expand Up @@ -81,7 +80,7 @@ def close(self) -> None:
# 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]
Expand All @@ -90,7 +89,9 @@ def fetch_impl(
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.
"""
Expand Down
Loading