- What’s new in Tornado 6.0
- What’s new in Tornado 6.0
- Mar 1, 2019
- Backwards-incompatible changes
- General changes
- tornado.auth
- tornado.concurrent
- tornado.gen
- tornado.httpclient
- tornado.httputil
- tornado.ioloop
- tornado.iostream
- tornado.log
- tornado.netutil
- tornado.platform.twisted
- tornado.simple_httpclient
- tornado.stack_context
- tornado.tcpserver
- tornado.testing
- tornado.web
- tornado.websocket
- tornado.wsgi
What’s new in Tornado 6.0
What’s new in Tornado 6.0
Mar 1, 2019
Backwards-incompatible changes
- Python 2.7 and 3.4 are no longer supported; the minimum supported Python version is 3.5.2.
- APIs deprecated in Tornado 5.1 have been removed. This includes the
tornado.stack_contextmodule and mostcallbackarguments throughout the package. All removed APIs emitted DeprecationWarning when used in Tornado 5.1, so running your application with the-WdPython command-line flag or the environment variablePYTHONWARNINGS=dshould tell you whether your application is ready to move to Tornado 6.0. .WebSocketHandler.getis now a coroutine and must be called accordingly in any subclasses that override this method (but note that overridinggetis not recommended; eitherprepareoropenshould be used instead).
General changes
- Tornado now includes type annotations compatible with
mypy. These annotations will be used when type-checking your application withmypy, and may be usable in editors and other tools. - Tornado now uses native coroutines internally, improving performance.
tornado.auth
- All
callbackarguments in this package have been removed. Use the coroutine interfaces instead. - The
OAuthMixin._oauth_get_usermethod has been removed. Override _oauth_get_user_future instead.
tornado.concurrent
- The
callbackargument to run_on_executor has been removed. return_futurehas been removed.
tornado.gen
- Some older portions of this module have been removed. This includes
engine,YieldPoint,Callback,Wait,WaitAll,MultiYieldPoint, andTask. - Functions decorated with
@gen.coroutineno longer acceptcallbackarguments.
tornado.httpclient
- The behavior of
raise_error=Falsehas changed. Now only suppresses the errors raised due to completed responses with non-200 status codes (previously it suppressed all errors). - The
callbackargument to AsyncHTTPClient.fetch has been removed.
tornado.httputil
HTTPServerRequest.writehas been removed. Use the methods ofrequest.connectioninstead.- Unrecognized
Content-Encodingvalues now log warnings only for content types that we would otherwise attempt to parse.
tornado.ioloop
IOLoop.set_blocking_signal_threshold,IOLoop.set_blocking_log_threshold,IOLoop.log_stack, andIOLoop.handle_callback_exceptionhave been removed.- Improved performance of IOLoop.add_callback.
tornado.iostream
- All
callbackarguments in this module have been removed except for BaseIOStream.set_close_callback. streaming_callbackarguments to BaseIOStream.read_bytes and BaseIOStream.read_until_close have been removed.- Eliminated unnecessary logging of “Errno 0”.
tornado.log
- Log files opened by this module are now explicitly set to UTF-8 encoding.
tornado.netutil
- The results of
getaddrinfoare now sorted by address family to avoid partial failures and deadlocks.
tornado.platform.twisted
TornadoReactorandTwistedIOLoophave been removed.
tornado.simple_httpclient
- The default HTTP client now supports the
network_interfacerequest argument to specify the source IP for the connection. - If a server returns a 3xx response code without a
Locationheader, the response is raised or returned directly instead of trying and failing to follow the redirect. - When following redirects, methods other than
POSTwill no longer be transformed intoGETrequests. 301 (permanent) redirects are now treated the same way as 302 (temporary) and 303 (see other) redirects in this respect. - Following redirects now works with
body_producer.
tornado.stack_context
- The
tornado.stack_contextmodule has been removed.
tornado.tcpserver
- TCPServer.start now supports a
max_restartsargument (same as fork_processes).
tornado.testing
- AsyncHTTPTestCase now drops all references to the Application during
tearDown, allowing its memory to be reclaimed sooner. - AsyncTestCase now cancels all pending coroutines in
tearDown, in an effort to reduce warnings from the python runtime about coroutines that were not awaited. Note that this may causeasyncio.CancelledErrorto be logged in other places. Coroutines that expect to be running at test shutdown may need to catch this exception.
tornado.web
- The
asynchronousdecorator has been removed. - The
callbackargument to RequestHandler.flush has been removed. - StaticFileHandler now supports large negative values for the
Rangeheader and returns an appropriate error forend > start. - It is now possible to set
expires_daysinxsrf_cookie_kwargs.
tornado.websocket
- Pings and other messages sent while the connection is closing are now silently dropped instead of logging exceptions.
- Errors raised by
open()are now caught correctly when this method is a coroutine.
tornado.wsgi
WSGIApplicationandWSGIAdapterhave been removed.
