bpo-46752: Introduce task groups in asyncio by gvanrossum · Pull Request #31270 · python/cpython

added 7 commits

February 10, 2022 15:54
My plan is roughly the following:

- [x] Copy the files from EdgeDb without modifications
      (named following asyncio conventions)
- [ ] Bang on the tests until they will run
- [ ] Bang on the tests until they pass
- [ ] Remove pre-3.11 compatibility code
- [ ] Switch from MultiError to ExceptionGroup
- [ ] Other cleanup
- [ ] Add a public API to tasks.py to replace `__cancel_requested__`
Two remaining issues:

- [ ] _test_taskgroup_21 doesn't work (it didn't in EdgeDb either)
- [ ] the test framework complains about a change to the event loop policy
This required some changes to the tests since EdgeDb's MultiError
has some ergonomic conveniences that ExceptionGroup doesn't:

- A helper method to get the types of the exceptions
- It puts the number and types of the exceptions in the message

Also, in one case (test_taskgroup_14) an EG nested inside another
EG was raised, whereas the original code just raised one EG.
This remains to be investigated.

@gvanrossum

@gvanrossum

Just use [Base]ExceptionGroup

@gvanrossum

@gvanrossum

@gvanrossum

We stop when there are no unfinished tasks,
and then no new tasks can be created.

(TODO: more thorough testing of edge cases?)

1st1

1st1

@1st1

@1st1

1st1

1st1 approved these changes Feb 15, 2022

This was referenced

Feb 21, 2022