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 show_group param to traceback.format_exception_only function #111388

Closed
sobolevn opened this issue Oct 27, 2023 · 0 comments
Closed

Add show_group param to traceback.format_exception_only function #111388

sobolevn opened this issue Oct 27, 2023 · 0 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 27, 2023

Feature or enhancement

This function does not have this param:

cpython/Lib/traceback.py

Lines 151 to 166 in 7f9a99e

def format_exception_only(exc, /, value=_sentinel):
"""Format the exception part of a traceback.
The return value is a list of strings, each ending in a newline.
The list contains the exception's message, which is
normally a single string; however, for :exc:`SyntaxError` exceptions, it
contains several lines that (when printed) display detailed information
about where the syntax error occurred. Following the message, the list
contains the exception's ``__notes__``.
"""
if value is _sentinel:
value = exc
te = TracebackException(type(value), value, None, compact=True)
return list(te.format_exception_only())

While the format_exception_only method of TracebackException does have this param. So, in order to proceed with #104150 I need this function to give me ExceptionGroup information.

I have a PR ready.

Linked PRs

@sobolevn sobolevn added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Oct 27, 2023
@sobolevn sobolevn self-assigned this Oct 27, 2023
sobolevn added a commit to sobolevn/cpython that referenced this issue Oct 27, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant