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.
Ben Darnell [Sat, 26 Sep 2020 19:32:56 +0000 (15:32 -0400)]
test: Refactor CI configuration
- Add osx and windows builds on travis
- Stop running -full test suites on every python version on arm64
- Use cibuildwheel to build for all python versions in one job per
platform
- Bring a single test configuration and linters up to a first "quick"
stage before starting the whole matrix
- Push the resulting wheels (and sdist) to pypi on tag builds
simple_httpclient: handle connect_timeout or request_timeout of 0
Using a connect_timeout or request_timeout of 0 was effectively
invalid for simple_httpclient: it would skip the actual request
entirely (because the bulk of the logic was inside "if timeout:").
This was not checked for or raised as an error, it just behaved
unexpectedly.
Change simple_httpclient to always assert these timeouts are not None
and to support the 0 value similar to curl (where request_timeout=0
means no timeout, and connect_timeout=0 means curl default 300 seconds
which is very very long for a tcp connection).
Amit Patel [Sat, 15 Aug 2020 23:05:49 +0000 (16:05 -0700)]
Update links on home page
* Updated http links to the https versions when possible.
* Updated links to Google Groups to match their new URL format.
* Updated links to other projects to match their new locations.
* And finally, updated link to FriendFeed to go to the Wikipedia page, because friendfeed.com is just a redirect to facebook.com now :-( :-(
On Python 3, super does not need to be called with arguments where as on
Python 2, super needs to be called with a class object and an instance.
This commit updates the super usage using automated regex-based search
and replace. After the automated changes were made, each change was
individually checked before committing.
Ben Darnell [Tue, 1 Sep 2020 20:48:47 +0000 (16:48 -0400)]
asyncio: Refactor selector to callbacks instead of coroutine
Restarting the event loop to "cleanly" shut down a coroutine introduces
other problems (mainly manifesting as errors logged while running
tornado.test.gen_test). Replace the coroutine with a pair of callbacks
so we don't need to do anything special to shut down without logging
warnings.
Ben Darnell [Mon, 6 Jul 2020 00:48:16 +0000 (20:48 -0400)]
asyncio: Rework AddThreadSelectorEventLoop
Running a whole event loop on the other thread leads to tricky
synchronization problems. Instead, keep as much as possible on the
main thread, and call out to a second thread only for the blocking
select system call itself.
Ben Darnell [Sat, 22 Feb 2020 23:36:11 +0000 (18:36 -0500)]
asyncio: Improve support Python 3.8 on Windows
This commit removes the need for applications to work around the
backwards-incompatible change to the default event loop. Instead,
Tornado will detect the use of the windows proactor event loop and
start a selector event loop in a separate thread.
Ben Darnell [Mon, 17 Feb 2020 21:11:23 +0000 (16:11 -0500)]
iostream_test: Improve cleanup
Closing the file descriptor without removing the corresponding handler
is technically incorrect, although the default IOLoops don't have a
problem with it.
This function is obsolete: Since python 3.4, file descriptors created
by python are non-inheritable by default (and in the event you create
a file descriptor another way, a standard function os.set_inheritable
is available).
The windows implementation of this function was also apparently
broken, but this went unnoticed because the default behavior on
windows is for file descriptors to be non-inheritable.
Ben Darnell [Sat, 20 Jun 2020 17:09:59 +0000 (13:09 -0400)]
auth: Fix example code
Continuation of #2811
The oauth2 version of authorize_redirect is no longer a coroutine, so
don't use await in example code. The oauth1 version is still a
coroutine, but one twitter example was incorrectly calling it with
yield instead of await.
Ben Darnell [Fri, 19 Jun 2020 18:59:46 +0000 (14:59 -0400)]
ci: Drop tox-venv
Its README says it is mostly obsolete due to improvements in
virtualenv. Using it appears to cause problems related to
https://github.com/pypa/setuptools/issues/1934 because virtualenv
installs the wheel package by default but venv doesn't.
Ben Darnell [Fri, 19 Jun 2020 18:36:36 +0000 (14:36 -0400)]
test: Add a sleep to deflake a test
Not sure why this has recently started happening in some environments,
but killing a process too soon causes the wrong exit status in some
python builds on macOS.
We were using conda to get access to python 3.7 before rtd supported
it in their regular builds, but this led to problems pinning a
specific version of sphinx. See
https://github.com/readthedocs/readthedocs.org/issues/6870