Message333770
So yes, the `clear_frames` function will force a running generator to close. See https://github.com/python/cpython/blob/3.7/Objects/frameobject.c#L566, it explicitly does a Finalize. Would that be the desired behaviour for assertRaises is not clear. I find it strange that catching an exception is closing my running coroutine.
The reproduce example can be lowered to something like::
import asyncio
async def background(error_future):
try:
raise ValueError
except Exception as exc:
error_future.set_exception(exc)
await asyncio.sleep(1)
async def main():
loop = asyncio.get_event_loop()
error_future = loop.create_future()
task = asyncio.create_task(background(error_future))
await asyncio.wait([error_future])
exc = error_future.exception()
import traceback
traceback.clear_frames(exc.__traceback__)
# Will block forever, as task will never be waken up
await task
if __name__ == "__main__":
asyncio.run(main()) |
|
| Date |
User |
Action |
Args |
| 2019-01-16 14:25:49 | tvoinarovskyi | set | recipients:
+ tvoinarovskyi, asvetlov, yselivanov |
| 2019-01-16 14:25:48 | tvoinarovskyi | set | messageid: <1547648748.64.0.794019129938.issue35751@roundup.psfhosted.org> |
| 2019-01-16 14:25:48 | tvoinarovskyi | link | issue35751 messages |
| 2019-01-16 14:25:48 | tvoinarovskyi | create | |
|