- What’s new in Tornado 4.5
- What’s new in Tornado 4.5
- Apr 16, 2017
- Backwards-compatibility warning
- New module
- General changes
- tornado.auth
- tornado.autoreload
- tornado.concurrent
- tornado.gen
- tornado.http1connection
- tornado.httpclient
- tornado.httpserver
- tornado.httputil
- tornado.ioloop
- tornado.iostream
- tornado.log
- tornado.netutil
- tornado.process
- tornado.tcpclient
- tornado.tcpserver
- tornado.web
- tornado.websocket
- Demos
- Credits
What’s new in Tornado 4.5
What’s new in Tornado 4.5
Apr 16, 2017
Backwards-compatibility warning
- The tornado.websocket module now imposes a limit on the size of incoming messages, which defaults to 10MiB.
New module
- tornado.routing provides a more flexible routing system than the one built in to Application.
General changes
- Reduced the number of circular references, reducing memory usage and improving performance.
tornado.auth
- The tornado.auth module has been updated for compatibility with a change to Facebook’s access_token endpoint. This includes both the changes initially released in Tornado 4.4.3 and an additional change to support the
`session_expiresfield in the new format. Thesession_expiresfield is currently a string; it should be accessed asint(user['session_expires'])because it will change from a string to an int in Tornado 5.0.
tornado.autoreload
-
Autoreload is now compatible with the asyncio event loop.
-
Autoreload no longer attempts to close the IOLoop and all registered file descriptors before restarting; it relies on the
CLOEXECflag being set instead.
tornado.concurrent
- Suppressed some “‘NoneType’ object not callback” messages that could be logged at shutdown.
tornado.gen
-
yield Noneis now equivalent toyield gen.moment. moment is deprecated. This improves compatibility with asyncio. -
Fixed an issue in which a generator object could be garbage collected prematurely (most often when weak references are used.
-
New function is_coroutine_function identifies functions wrapped by coroutine or
engine.
tornado.http1connection
- The
Transfer-Encodingheader is now parsed case-insensitively.
tornado.httpclient
-
SimpleAsyncHTTPClientnow follows 308 redirects. -
CurlAsyncHTTPClientwill no longer accept protocols other thanhttpandhttps. To override this, setpycurl.PROTOCOLSandpycurl.REDIR_PROTOCOLSin aprepare_curl_callback. -
CurlAsyncHTTPClientnow supports digest authentication for proxies (in addition to basic auth) via the newproxy_auth_modeargument. -
The minimum supported version of
libcurlis now7.22.0.
tornado.httpserver
-
HTTPServer now accepts the keyword argument
trusted_downstreamwhich controls the parsing ofX-Forwarded-Forheaders. This header may be a list or set of IP addresses of trusted proxies which will be skipped in theX-Forwarded-Forlist. -
The
no_keep_aliveargument works again.
tornado.httputil
- url_concat correctly handles fragments and existing query arguments.
tornado.ioloop
-
Fixed 100% CPU usage after a callback returns an empty list or dict.
-
IOLoop.add_callback now uses a lockless implementation which makes it safe for use from
__del__methods. This improves performance of calls to add_callback from the IOLoop thread, and slightly decreases it for calls from other threads.
tornado.iostream
-
memoryview objects are now permitted as arguments to write.
-
The internal memory buffers used by IOStream now use bytearray instead of a list of bytes, improving performance.
-
Futures returned by write are no longer orphaned if a second call to
writeoccurs before the previous one is finished.
tornado.log
-
Colored log output is now supported on Windows if the colorama library is installed and the application calls
colorama.init()at startup. -
The signature of the LogFormatter constructor has been changed to make it compatible with logging.config.dictConfig.
tornado.netutil
- Worked around an issue that caused “LookupError: unknown encoding: latin1” errors on Solaris.
tornado.process
-
Subprocess no longer causes “subprocess still running” warnings on Python 3.6.
-
Improved error handling in cpu_count.
tornado.tcpclient
-
TCPClient now supports a
source_ipandsource_portargument. -
Improved error handling for environments where IPv6 support is incomplete.
tornado.tcpserver
-
TCPServer.handle_stream implementations may now be native coroutines.
-
Stopping a TCPServer twice no longer raises an exception.
tornado.web
-
RedirectHandler now supports substituting parts of the matched URL into the redirect location using str.format syntax.
-
New methods RequestHandler.render_linked_js, RequestHandler.render_embed_js, RequestHandler.render_linked_css, and RequestHandler.render_embed_css can be overridden to customize the output of UIModule.
tornado.websocket
-
WebSocketHandler.on_message implementations may now be coroutines. New messages will not be processed until the previous
on_messagecoroutine has finished. -
The
websocket_ping_intervalandwebsocket_ping_timeoutapplication settings can now be used to enable a periodic ping of the websocket connection, allowing dropped connections to be detected and closed. -
The new
websocket_max_message_sizesetting defaults to 10MiB. The connection will be closed if messages larger than this are received. -
Headers set by RequestHandler.prepare or RequestHandler.set_default_headers are now sent as a part of the websocket handshake.
-
Return values from WebSocketHandler.get_compression_options may now include the keys
compression_levelandmem_levelto set gzip parameters. The default compression level is now 6 instead of 9.
Demos
-
A new file upload demo is available in the file_upload directory.
-
A new TCPClient and TCPServer demo is available in the tcpecho directory.
-
Minor updates have been made to several existing demos, including updates to more recent versions of jquery.
Credits
The following people contributed commits to this release:
-
A. Jesse Jiryu Davis
-
Aaron Opfer
-
Akihiro Yamazaki
-
Alexander
-
Andreas Røsdal
-
Andrew Rabert
-
Andrew Sumin
-
Antoine Pietri
-
Antoine Pitrou
-
Artur Stawiarski
-
Ben Darnell
-
Brian Mego
-
Dario
-
Doug Vargas
-
Eugene Dubovoy
-
Iver Jordal
-
JZQT
-
James Maier
-
Jeff Hunter
-
Leynos
-
Mark Henderson
-
Michael V. DePalatis
-
Min RK
-
Mircea Ulinic
-
Ping
-
Ping Yang
-
Riccardo Magliocchetti
-
Samuel Chen
-
Samuel Dion-Girardeau
-
Scott Meisburger
-
Shawn Ding
-
TaoBeier
-
Thomas Kluyver
-
Vadim Semenov
-
matee
-
mike820324
-
stiletto
-
zhimin
-
依云
