mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ... (#125486)
* Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)"
This reverts commit e99650b80a
.
* fix incompatability with gh-124392
This commit is contained in:
parent
1bffd7a2a7
commit
0b28ea4a35
5 changed files with 157 additions and 15 deletions
|
@ -659,6 +659,28 @@ class BaseFutureTests:
|
|||
fut = self._new_future(loop=self.loop)
|
||||
fut.set_result(Evil())
|
||||
|
||||
def test_future_cancelled_result_refcycles(self):
|
||||
f = self._new_future(loop=self.loop)
|
||||
f.cancel()
|
||||
exc = None
|
||||
try:
|
||||
f.result()
|
||||
except asyncio.CancelledError as e:
|
||||
exc = e
|
||||
self.assertIsNotNone(exc)
|
||||
self.assertListEqual(gc.get_referrers(exc), [])
|
||||
|
||||
def test_future_cancelled_exception_refcycles(self):
|
||||
f = self._new_future(loop=self.loop)
|
||||
f.cancel()
|
||||
exc = None
|
||||
try:
|
||||
f.exception()
|
||||
except asyncio.CancelledError as e:
|
||||
exc = e
|
||||
self.assertIsNotNone(exc)
|
||||
self.assertListEqual(gc.get_referrers(exc), [])
|
||||
|
||||
|
||||
@unittest.skipUnless(hasattr(futures, '_CFuture'),
|
||||
'requires the C _asyncio module')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue