Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section about handling ExceptionGroups #1841

Merged
merged 2 commits into from
Feb 26, 2021

Conversation

iritkatriel
Copy link
Member

No description provided.

pep-0654.rst Outdated
Comment on lines 333 to 347
def traverse(exc, tbs=None, cause=None, context=None):
if tbs is None:
tbs = []
cause = exc.__cause__
context = exc.__context__

tbs.append(exc.__traceback__)
if isinstance(exc, ExceptionGroup):
for e in exc.errors:
traverse(e, tbs, cause, context)
else:
# exc is a leaf exception and its traceback
# is the concatenation of the traceback in tbs
process_leaf(exc, tbs, cause, context)
tbs.pop()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this to 4-space indents? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants