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

Added the "compact" keyword argument to TracebackException.__init__() #1914

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions trio/_core/_multierror.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,17 @@ def traceback_exception_init(
limit=None,
lookup_lines=True,
capture_locals=False,
compact=False,
Copy link
Member

Choose a reason for hiding this comment

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

Can we use *args, **kwargs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did that as first (as it is simpler), but figured it might be better from a static analysis perspective to add the actual new argument. I don't really care that much either way.

_seen=None,
):
if _seen is None:
_seen = set()

if sys.version_info >= (3, 10):
kwargs = {"compact": compact}
else:
kwargs = {}

# Capture the original exception and its cause and context as TracebackExceptions
traceback_exception_original_init(
self,
Expand All @@ -396,6 +402,7 @@ def traceback_exception_init(
lookup_lines=lookup_lines,
capture_locals=capture_locals,
_seen=_seen,
**kwargs,
)

# Capture each of the exceptions in the MultiError along with each of their causes and contexts
Expand Down