Replace MultiError with BaseExceptionGroup#2213
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2213 +/- ##
==========================================
+ Coverage 98.98% 99.00% +0.01%
==========================================
Files 119 117 -2
Lines 16165 16119 -46
Branches 3101 3122 +21
==========================================
- Hits 16001 15958 -43
+ Misses 114 113 -1
+ Partials 50 48 -2
|
d32401f to
f9f56f1
Compare
cb48061 to
b70f271
Compare
8e19279 to
21757c8
Compare
The __cause__ of the OSError will always be an ExceptionGroup going forward. MultiError's constructor, given a single element exception array, returned just that, but ExceptionGroup does not work the same way.
|
This needs discussion on whether to drop |
|
Here are my thoughts about deprecating
To maintain backwards compatibility, both use cases would have to be covered. Trio itself would have to raise Either way, a migration guide would probably be in order. |
|
Meh. Frankly I don't think we can achieve 100% backwards compatibility, which is especially bad since the affected code is on code paths that are typically not tested very well. Thus I'd advise to spend the effort on a good migration guide that covers all the bases, preferably from multiple angles. Code that wants to be able to handle both |
This seems to be the consensus (on Gitter as well). I will attempt to write a migration guide somewhere in the docs. |
16e33b1 to
95a7b9e
Compare
|
I amended the documentation and the news fragment to point users in the right direction. While this is not strictly a "How to migrate from MultiError to BaseExceptionGroup", trio users tend to be more tech savvy than the average Python user. I hope that is enough. |
These platforms don't work with Python 3.11 on GitHub Actions yet.
Now it works with BaseExceptionGroup too.
17103ae to
f9eff8e
Compare
I've restored the IPython custom error handler, even though I still feel this is the wrong place for it. It also now supports (Base)ExceptionGroup. |
Thanks. Hopefully IPython will implement proper EG support (including the backport) and we can remove Trio's patching of it soon.
I don't have easy access to an Ubuntu machine right now, but IIRC ubuntu installs a custom I guess the exceptiongroup backport doesn't print a warning like Trio previously would if it fails to patch |
I'm running Ubuntu on my home server and I can confirm that outside of a virtualenv, the apport hook is indeed present and will prevent exceptiongroup from installing its own hook. So, to not degrade the trio UX, I will fix this by adapting the old trio apport exceptionhook. |
Instead, we mark collapsible MultiErrors and collapse only those when necessary.
|
Code-wise this PR should be fine now. |
c20201f to
80889b2
Compare
|
Thanks for your hard work, @agronholm and @oremanj! We're lucky to have you. I'm really excited! Will release this tomorrow. |

This PR has two dependencies:
Drop Python 3.6 support #2210 (required)Drop dependency on async_generator #2212 (recommended but not strictly necessary)(skipped)Closes #2211.
Closes #2427.