This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Amos.Anderson
Recipients Amos.Anderson, asvetlov, yselivanov
Date 2021-11-24.20:55:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637787356.13.0.636054000901.issue45894@roundup.psfhosted.org>
In-reply-to
Content
If I do this instead:
```
    try:
        logger.info("raising exception")
        raise ValueError("my exception1")
    finally:
        logger.info("stopped")
        loop.stop()
        await asyncio.sleep(0.5)
```

i.e., do an `await` instead of a `return`, then the original exception is also lost:

```
INFO:root:start
DEBUG:asyncio:Using selector: EpollSelector
INFO:root:raising exception
INFO:root:stopped
ERROR:root:Event loop stopped before Future completed.
Traceback (most recent call last):
  File "test.py", line 37, in <module>
    asyncio.run(another_level())
  File "/home/amos/miniconda3/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/amos/miniconda3/lib/python3.8/asyncio/base_events.py", line 614, in run_until_complete
    raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
INFO:root:done
```

it's also a bit surprising that my handler in `another_level` didn't see either exception, but I'm not really sure what I'd expect in that case.
History
Date User Action Args
2021-11-24 20:55:56Amos.Andersonsetrecipients: + Amos.Anderson, asvetlov, yselivanov
2021-11-24 20:55:56Amos.Andersonsetmessageid: <1637787356.13.0.636054000901.issue45894@roundup.psfhosted.org>
2021-11-24 20:55:56Amos.Andersonlinkissue45894 messages
2021-11-24 20:55:56Amos.Andersoncreate