What’s new in Tornado 6.4.0
Nov 28, 2023
General Changes
Python 3.12 is now supported. Older versions of Tornado will work on Python 3.12 but may log deprecation warnings.
Deprecation Notices
IOLoop.add_callback_from_signalis suspected to have been broken since Tornado 5.0 and will be removed in version 7.0. Useasyncio.loop.add_signal_handlerinstead.The
client_secretargument toOAuth2Mixin.authorize_redirectis deprecated and will be removed in Tornado 7.0. This argument has never been used and other similar methods in this module don’t have it.TwitterMixinis deprecated and will be removed in the future.
tornado.auth
The
client_secretargument toOAuth2Mixin.authorize_redirectis deprecated and will be removed in Tornado 7.0. This argument has never been used and other similar methods in this module don’t have it.TwitterMixinis deprecated and will be removed in the future.
tornado.autoreload
Autoreload can now be used when the program is run as a directory rather than a file or module.
New CLI flag
--until-successre-runs the program on any failure but stops after the first successful run.
tornado.concurrent
Fixed reference cycles that could lead to increased memory usage.
tornado.escape
Several methods in this module now simply pass through to their equivalents in the standard library.
tornado.gen
This module now holds a strong reference to all running
asyncio.Taskobjects it creates. This prevents premature garbage collection which could cause warnings like “Task was destroyed but it is pending!”.
tornado.ioloop
IOLoop.add_callback_from_signalis suspected to have been broken since Tornado 5.0 and will be removed in version 7.0. Useasyncio.loop.add_signal_handlerinstead.The type annotation for
IOLoop.run_in_executorhas been updated to match the updated signature ofasyncio.loop.run_in_executor.Fixed reference cycles that could lead to increased memory usage.
tornado.locale
format_timestampnow supports “aware” datetime objects.
tornado.platform.asyncio
The shutdown protocol for
AddThreadSelectorEventLoopnow requires the use ofasyncio.runorasyncio.loop.shutdown_asyncgensto avoid leaking the thread.Introduced
SelectorThreadclass containing the core functionality ofAddThreadSelectorEventLoop.The
close()method ofAddThreadSelectorEventLoopis now idempotent.
tornado.web
StaticFileHandler.get_modified_timenow supports “aware” datetime objects and the default implementation now returns aware objects.
tornado.websocket
Unclosed client connections now reliably log a warning. Previously the warning was dependent on garbage collection and whether the
ping_intervaloption was used.The
subprotocolsargument toWebSocketClientConnectionnow defaults to None instead of an empty list (which was mutable and reused)