groove-x / trio-util

Utility library for the Python Trio async/await framework
https://trio-util.readthedocs.io/
MIT License
68 stars 6 forks source link

minor bugs in defer_to_cancelled() #1

Open belm0 opened 5 years ago

belm0 commented 5 years ago

njs noticed a bug in early exit:

that early exit on line 84 is wrong btw... it won't notice the Cancelled in MultiError([RuntimeError, MultiError([Cancelled, Cancelled])])

https://github.com/groove-x/trio-util/blob/bd32a3e3cdc448ee6ccf66456126c08953927575/src/trio_util/_exceptions.py#L84-L85

also this function may be adding unnecessary context on exceptions:

those raise statements will automatically attach the original MultiError object as a context

could do a __context__ dance along the lines of MultiError.catch() internals

belm0 commented 4 years ago

that early exit on line 84 is wrong btw... it won't notice the Cancelled in MultiError([RuntimeError, MultiError([Cancelled, Cancelled])])

fixed in 58db781

those raise statements will automatically attach the original MultiError object as a context

I haven't looked at this yet