You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Not sure if this is worth fixing given that we're hopefully going to rip out MultiError.filter soon, see #611. But figured I should write it down. If nothing else this is more evidence for how tricky MultiError.filter is...]
I just noticed this playing with python notes-to-self/trivial-err.py, after #640 was merged. We get:
[... some output elided ...]
Details of embedded exception 2:
trio.MultiError: NameError('Bob',), KeyError()
Details of embedded exception 1:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 12, in child2
nursery.start_soon(grandchild2)
File "/home/njs/trio/trio/_core/_run.py", line 399, in __aexit__
raise scope_exc
File "notes-to-self/trivial-err.py", line 18, in grandchild2
raise NameError("Bob")
NameError: Bob
Details of embedded exception 2:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 12, in child2
nursery.start_soon(grandchild2)
File "/home/njs/trio/trio/_core/_run.py", line 399, in __aexit__
raise scope_exc
File "notes-to-self/trivial-err.py", line 15, in grandchild1
raise KeyError
KeyError
Notice how the MultiError at the top has no traceback frames, and the NameError and KeyError inside it have identical child2 and __aexit__ frames.
What should happen here is that the child2 and __aexit__ frames are on the MultiError once, instead of being pushed down onto the individual exceptions.
I added some code to CancelScope._close to see what was going on:
and that embedded MultiError with the NameError and KeyError inside it has those two frames on it:
Details of embedded exception 3:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 12, in child2
nursery.start_soon(grandchild2)
File "/home/njs/trio/trio/_core/_run.py", line 399, in __aexit__
raise scope_exc
trio.MultiError: Cancelled(), Cancelled(), NameError('Bob',), KeyError()
[...]
Details of embedded exception 3:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 18, in grandchild2
raise NameError("Bob")
NameError: Bob
Details of embedded exception 4:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 15, in grandchild1
raise KeyError
KeyError
And then MultiError.filter removes the Cancelled exceptions, and somehow in the process it ends up pushing down the tracebacks onto the individual frames:
post-filter
trio.MultiError: ValueError(), <MultiError: NameError('Bob',), KeyError()>
[...]
Details of embedded exception 2:
trio.MultiError: NameError('Bob',), KeyError()
Details of embedded exception 1:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 12, in child2
nursery.start_soon(grandchild2)
File "/home/njs/trio/trio/_core/_run.py", line 399, in __aexit__
raise scope_exc
File "notes-to-self/trivial-err.py", line 18, in grandchild2
raise NameError("Bob")
NameError: Bob
Details of embedded exception 2:
Traceback (most recent call last):
File "notes-to-self/trivial-err.py", line 12, in child2
nursery.start_soon(grandchild2)
File "/home/njs/trio/trio/_core/_run.py", line 399, in __aexit__
raise scope_exc
File "notes-to-self/trivial-err.py", line 15, in grandchild1
raise KeyError
KeyError
That's not supposed to happen... we're replacing one MultiError with another, so the traceback frames are supposed to be transferred over.
The text was updated successfully, but these errors were encountered:
[Not sure if this is worth fixing given that we're hopefully going to rip out
MultiError.filter
soon, see #611. But figured I should write it down. If nothing else this is more evidence for how trickyMultiError.filter
is...]I just noticed this playing with
python notes-to-self/trivial-err.py
, after #640 was merged. We get:Notice how the
MultiError
at the top has no traceback frames, and theNameError
andKeyError
inside it have identicalchild2
and__aexit__
frames.What should happen here is that the
child2
and__aexit__
frames are on theMultiError
once, instead of being pushed down onto the individual exceptions.I added some code to
CancelScope._close
to see what was going on:and it looks like at some point we have an exception:
and that embedded
MultiError
with theNameError
andKeyError
inside it has those two frames on it:And then
MultiError.filter
removes theCancelled
exceptions, and somehow in the process it ends up pushing down the tracebacks onto the individual frames:That's not supposed to happen... we're replacing one
MultiError
with another, so the traceback frames are supposed to be transferred over.The text was updated successfully, but these errors were encountered: