]> git.ipfire.org Git - thirdparty/tornado.git/commit
ioloop,concurrent: Fix reference cycles
authorBen Darnell <ben@bendarnell.com>
Tue, 22 Aug 2023 03:03:39 +0000 (23:03 -0400)
committerBen Darnell <ben@bendarnell.com>
Tue, 22 Aug 2023 03:03:39 +0000 (23:03 -0400)
commit1d5fc98018bd1d742b1608634bfb57f6e3d990f0
treece5b7adc0b7186cfcb24fbc2cd3259fc74c3b60f
parentddb7e88afd4501e34c5c3bcebd10265f89aa0cf9
ioloop,concurrent: Fix reference cycles

In a few places we were referring to a future via a closure instead
of using the reference passed as an argument to the callback.  This
sometimes causes a reference cycle that can slow GC. This commit
adds a test which covers two of the cases (chain_future and the
concurrent.future branch of add_future) while the third was found by
inspecting other calls to add_done_callback for obvious instances of
this pattern.

Fixes #2620
tornado/concurrent.py
tornado/ioloop.py
tornado/test/circlerefs_test.py