You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IsolatedAsyncioTestCase freezes when exception is raised #83282
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-10-26.16:29:40.338>created_at=<Date2019-12-19.19:44:59.009>labels= ['3.8', 'type-crash', 'expert-asyncio']
title='IsolatedAsyncioTestCase freezes when exception is raised'updated_at=<Date2021-03-02.00:30:08.714>user='https://github.com/fornellas'
New changeset d549d0b by Miss Islington (bot) in branch '3.8': bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654) d549d0b
r-owen commented on Mar 2, 2021
r-owenmannequin
Mannequin
More actions
Here is a variant that also hangs, I suspect for the same reason. The task raises asyncio.CancelledError which inherits from BaseException and my guess is it somehow kills the event loop.
importasyncioimportunittestclassDemonstrateHang(unittest.IsolatedAsyncioTestCase):
asyncdeftest_hang(self):
task=asyncio.create_task(asyncio.sleep(2))
awaitasyncio.sleep(0.1)
task.cancel()
awaittask# this also hangs: await asyncio.wait_for(task, 5)
Activity
fornellas commentedon Dec 19, 2019
IsolatedAsyncioTestCase freezes whenever an exception that inherits from BaseException is raised:
A kind of similar issue present on 3.7 was fixed on 3.8 here https://github.com/python/cpython/blob/3.8/Lib/asyncio/events.py#L84, where BaseExceptions would not be correctly handled by the event loop, this seems somewhat related.
I had a look at IsolatedAsyncioTestCase implementation, did not spot any obvious broken thing there, I could use some light here. Thanks.
lisroach commentedon Oct 26, 2020
New changeset 8374d2e by Lisa Roach in branch 'master':
bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654)
8374d2e
miss-islington commentedon Dec 16, 2020
New changeset 9d409d6 by Miss Islington (bot) in branch '3.9':
bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654)
9d409d6
miss-islington commentedon Dec 16, 2020
New changeset d549d0b by Miss Islington (bot) in branch '3.8':
bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654)
d549d0b
r-owen commentedon Mar 2, 2021
Here is a variant that also hangs, I suspect for the same reason. The task raises asyncio.CancelledError which inherits from BaseException and my guess is it somehow kills the event loop.