Ben Darnell [Mon, 17 Jan 2022 00:27:49 +0000 (19:27 -0500)]
test: Remove twisted compatibility test
Now that compatibility between tornado and twisted is based on
asyncio, this test isn't very useful any more. It is broken by the
deprecations introduced in Python 3.10 and isn't worth reviving.
Ben Darnell [Fri, 31 Dec 2021 02:34:11 +0000 (21:34 -0500)]
test: Fix some test interactions
These tests work in isolation but cause failures in the full suite
due to the leftover state of the asyncio event loop. Add cleanup to one
test and make another more tolerant of leftover state.
Ben Darnell [Wed, 29 Dec 2021 00:44:19 +0000 (19:44 -0500)]
netutil: Use newer ssl APIs
Pass a client/server flag to all SSL context creations. This is required
to avoid deprecations in Python 3.10. This is a behavior change for
client-side connections: certificate verification and hostname checks
are now enabled in more situations (previously, the high-level
interfaces would generally enforce these requirements but the low-level
interfaces like SSLIOStream did not).
Ben Darnell [Tue, 28 Dec 2021 20:56:33 +0000 (15:56 -0500)]
testing: Deprecate AsyncTestCase
The interfaces defined by this class rely on an event loop being
"current" even though it is not running; this is incompatible with
the future of the asyncio module.
It's too big a task to rewrite all the tests right now, so just
swallow deprecation warnings for "no current event loop".
Ben Darnell [Tue, 28 Dec 2021 19:24:42 +0000 (14:24 -0500)]
ioloop: Deprecate setting current ioloop for python 3.10
asyncio.get_event_loop and related methods are deprecated in python
3.10, so deprecate some IOLoop functionality to match. Specifically,
make_current, clear_current, and the IOLoop constructor are deprecated
in favor of initializing the asyncio event loop and calling
IOLoop.current(). (The IOLoop constructor is not deprecated if
make_current=False is used. This is useful in test frameworks but is
not expected to see general use).
Ben Darnell [Fri, 3 Dec 2021 18:07:30 +0000 (13:07 -0500)]
asyncio: Deprecate AnyThreadEventLoopPolicy
Implicit creation of event loops has been deprecated in Python 3.10.
Since AnyThreadEventLoopPolicy modifies the rules for implicit loop
creation, it is also deprecated.
Ben Darnell [Fri, 31 Dec 2021 20:26:28 +0000 (15:26 -0500)]
ci: move CI to github actions
Our previous CI on Travis has been broken for a while due to their
move from travis-ci.org to travis-ci.com. Instead of fixing things up
there, move everything to github actions.
Fix case-sensitivity for Content-Encoding: gzip. as per rfc7231 the Content-Encoding values are case-insensitive https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.2.1
Alex Vandiver [Wed, 7 Apr 2021 20:11:15 +0000 (13:11 -0700)]
is_valid_ip: Do not raise exceptions on too-long input.
is_valid_ip calls `socket.getaddrinfo` with `socket.AI_NUMERICHOST` on
the potential "ip"; even though IP addresses are not hostnames and do
not use the `idna` encoding, `socket.getaddrinfo` will raise
UnicodeError if the potential "ip" is longer than 63 characters long,
the RFC-mandated max hostname length.
Catch these UnicodeErrors and return false for too-long IPs, rather
than raising an exception.
When used with asyncio.Future, WaitIterator may skip indices in some
cases. This is caused by multiple _return_result calls after another,
without having the chain_future call finish in between. This is fixed
here by not hanging on to the _running_future anymore, which forces
subsequent _return_result calls to add to _finished, instead of causing
the previous result to be silently dropped.
Florian Best [Thu, 19 Nov 2020 09:45:28 +0000 (10:45 +0100)]
Issue #2954: prevent logging error messages for not existing translation files
Every not existing translation file for the existing locales logged an error message:
Cannot load translation for 'ps': [Errno 2] No such file or directory: '/usr/share/locale/ps/LC_MESSAGES/foo.mo'
Ben Darnell [Mon, 2 Nov 2020 02:27:27 +0000 (21:27 -0500)]
platform: Deprecate twisted and cares resolvers
These were most interesting when the default resolver blocked
the main thread. Now that the default is to use a thread pool,
there is little if any demand for alternative resolvers just to
avoid threads.
Ben Darnell [Sun, 1 Nov 2020 21:08:30 +0000 (16:08 -0500)]
docs: Upgrade to latest version of sphinx
This version attempts to resolve types found in type annotations,
but in many cases it can't find them so silence a bunch of warnings.
(Looks like deferred annotation processing will make this better but
we won't be able to use that until we drop Python 3.6)
Ben Darnell [Sat, 31 Oct 2020 16:15:23 +0000 (12:15 -0400)]
maint: Prune requirements lists
Remove dependencies that are rarely used outside of tox. The main
motivation is to give dependabot less to worry about when an indirect
dependency has a security vulnerability.
Ben Darnell [Mon, 12 Oct 2020 00:54:01 +0000 (20:54 -0400)]
asyncio: Manage our own thread instead of an executor
Python 3.9 changed the behavior of ThreadPoolExecutor at interpreter
shutdown (after the already-tricky import-order issues around
atexit hooks). Avoid these issues by managing the thread by hand.
The asyncio event loop provides enough contextvars support out of the
box for basic contextvars functionality to work in tornado coroutines,
but not `contextvars.reset`. Prior to this change, each yield created
a new "level" of context, when an entire coroutine should be on the
same level. This is necessary for the reset method to work.