Hi folks,

I wanted to raise visibility about a few asyncio PR's I'm hoping can be merged before the 3.9 beta deadline -- which is ~10 days away. The four PR's are listed at the end of this message.

The PR's are on the simple side compared to others. I think collectively they can make asyncio a lot easier to use and troubleshoot. This is because they address various situations where parts of the traceback or stacktrace can go missing in asyncio, which makes issues a lot harder to pin down.

The issue of incomplete tracebacks was probably the biggest pain point for me when I was starting out with asyncio. Like, here's an email I sent to this list two and a half years ago:
https://mail.python.org/pipermail/async-sig/2017-November/000403.html

Below are the four issues, in the order in which I think they should be reviewed (in order of both simplicity and impact, in my estimation):

1) bpo-29587: Enable exception chaining for gen.throw() with "yield from":
https://github.com/python/cpython/pull/19858

This PR addresses a third example of the following bpo issue (not one of the two listed by Nathaniel, but with the same root cause as the others):
https://bugs.python.org/issue29587
This aspect causes parts of the traceback to go missing / be swallowed in certain situations if an exception happens while awaiting an async task.

2) bpo-31033: Full tracebacks for cancelled asyncio tasks:
https://github.com/python/cpython/pull/19951

This is a big one because currently, the traceback for cancelled tasks shows almost nothing. This PR would show a traceback starting with what code got interrupted, and how the exception bubbled up from there.
It's one aspect of the following issue about making cancelled tasks easier to diagnose:
https://bugs.python.org/issue31033

3) bpo-29590: fix stack trace for gen.throw() with yield from
https://github.com/python/cpython/pull/19896

This is a second issue that Nathaniel filed:
https://bugs.python.org/issue29590
It's about how stack trace entries get lost if you're trying to profile asyncio code.

4) bpo-31033: Add a msg argument to Future.cancel() and Task.cancel()
https://github.com/python/cpython/pull/19979

This PR would let you pass a "msg" to cancel(), which would show up in the traceback as the CancelledError's message. This is the other side of #2 (bpo-31033) because it would let you record _why_ a task was cancelled, or other details (as opposed to seeing _what_ got cancelled).

Thank you,
--Chris