Skip to content

Add show_group param to traceback.format_exception_only function #111388

Closed
@sobolevn

Description

@sobolevn

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

Metadata

Metadata

Assignees

Labels

stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions