Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions docs/caresresolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ wrapper ``pycares``).
the default for ``tornado.simple_httpclient``, but other libraries
may default to ``AF_UNSPEC``.

This class requires ``pycares`` version 4. Since this class is deprecated, it will not be
updated to support ``pycares`` version 5.

.. deprecated:: 6.2
This class is deprecated and will be removed in Tornado 7.0. Use the default
thread-based resolver instead.
8 changes: 4 additions & 4 deletions tornado/test/httputil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_disposition_param_linear_performance(self):
# to the content-disposition header, specifically for semicolons within
# quoted strings.
def f(n):
start = time.time()
start = time.perf_counter()
message = (
b"--1234\r\nContent-Disposition: form-data; "
+ b'x="'
Expand All @@ -295,7 +295,7 @@ def f(n):
args: dict[str, list[bytes]] = {}
files: dict[str, list[HTTPFile]] = {}
parse_multipart_form_data(b"1234", message, args, files)
return time.time() - start
return time.perf_counter() - start

d1 = f(1_000)
d2 = f(10_000)
Expand Down Expand Up @@ -496,11 +496,11 @@ def test_invalid_header_names(self):

def test_linear_performance(self):
def f(n):
start = time.time()
start = time.perf_counter()
headers = HTTPHeaders()
for i in range(n):
headers.add("X-Foo", "bar")
return time.time() - start
return time.perf_counter() - start

# This runs under 50ms on my laptop as of 2025-12-09.
d1 = f(10_000)
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ basepython =
deps =
full: pycurl
full: twisted
full: pycares
# Pycares 5 has some backwards-incompatible changes that we don't support.
# And since CaresResolver is deprecated, I do not expect to fix it, so just
# pin the previous version. (This should really be in requirements.{in,txt} instead)
full: pycares<5
docs: -r{toxinidir}/requirements.txt
lint: -r{toxinidir}/requirements.txt

Expand Down