]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-35125: remove inner callback on outer cancellation in asyncio shield (GH-10340)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 7 May 2019 19:38:00 +0000 (12:38 -0700)
committerGitHub <noreply@github.com>
Tue, 7 May 2019 19:38:00 +0000 (12:38 -0700)
commit299f69c24c5f0fcfea0b7385b0da661cda78df19
treeefcf867f6f2ae23df11499760b2071ef3f978aec
parent19ca5b500af4b66e1082a03d8fbf448e1f56af30
bpo-35125: remove inner callback on outer cancellation in asyncio shield (GH-10340)

When the future returned by shield is cancelled, its completion callback of the
inner future is not removed. This makes the callback list of inner inner future
grow each time a shield is created and cancelled.

This change unregisters the callback from the inner future when the outer
future is cancelled.

https://bugs.python.org/issue35125
(cherry picked from commit b35acc5b3a0148c5fd4462968b310fb436726d5a)

Co-authored-by: Romain Picard <romain.picard@oakbits.com>
Lib/asyncio/tasks.py
Lib/test/test_asyncio/test_tasks.py
Misc/NEWS.d/next/Library/2019-02-15-17-18-50.bpo-35125.h0xk0f.rst [new file with mode: 0644]