aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-05-05 21:32:23 +0200
committerGitHub <noreply@github.com>2024-05-05 21:32:23 +0200
commitf27f8c790af1233d499b795af1c0d1b36aaecaf5 (patch)
tree22c502c6382512fafbb63e3020c8462e5400d4df /Lib/traceback.py
parent40cc809902304f60c6e1c933191dd4d64e570e28 (diff)
downloadcpython-f27f8c790af1233d499b795af1c0d1b36aaecaf5.tar.gz
cpython-f27f8c790af1233d499b795af1c0d1b36aaecaf5.zip
gh-111201: A new Python REPL (GH-111567)
Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 8403173ade7..1878779e154 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -140,7 +140,7 @@ def _print_exception_bltin(exc, /):
def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
- chain=True):
+ chain=True, **kwargs):
"""Format a stack trace and the exception information.
The arguments have the same meaning as the corresponding arguments
@@ -149,9 +149,10 @@ def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
these lines are concatenated and printed, exactly the same text is
printed as does print_exception().
"""
+ colorize = kwargs.get("colorize", False)
value, tb = _parse_value_tb(exc, value, tb)
te = TracebackException(type(value), value, tb, limit=limit, compact=True)
- return list(te.format(chain=chain))
+ return list(te.format(chain=chain, colorize=colorize))
def format_exception_only(exc, /, value=_sentinel, *, show_group=False):