mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
gh-130250: fix regression in traceback.print_last (#130318)
This commit is contained in:
parent
73801864d8
commit
6c982aeb54
4 changed files with 16 additions and 8 deletions
|
|
@ -204,7 +204,7 @@ def _safe_string(value, what, func=str):
|
|||
# --
|
||||
|
||||
def print_exc(limit=None, file=None, chain=True):
|
||||
"""Shorthand for 'print_exception(sys.exception(), limit, file, chain)'."""
|
||||
"""Shorthand for 'print_exception(sys.exception(), limit=limit, file=file, chain=chain)'."""
|
||||
print_exception(sys.exception(), limit=limit, file=file, chain=chain)
|
||||
|
||||
def format_exc(limit=None, chain=True):
|
||||
|
|
@ -212,15 +212,15 @@ def format_exc(limit=None, chain=True):
|
|||
return "".join(format_exception(sys.exception(), limit=limit, chain=chain))
|
||||
|
||||
def print_last(limit=None, file=None, chain=True):
|
||||
"""This is a shorthand for 'print_exception(sys.last_exc, limit, file, chain)'."""
|
||||
"""This is a shorthand for 'print_exception(sys.last_exc, limit=limit, file=file, chain=chain)'."""
|
||||
if not hasattr(sys, "last_exc") and not hasattr(sys, "last_type"):
|
||||
raise ValueError("no last exception")
|
||||
|
||||
if hasattr(sys, "last_exc"):
|
||||
print_exception(sys.last_exc, limit, file, chain)
|
||||
print_exception(sys.last_exc, limit=limit, file=file, chain=chain)
|
||||
else:
|
||||
print_exception(sys.last_type, sys.last_value, sys.last_traceback,
|
||||
limit, file, chain)
|
||||
limit=limit, file=file, chain=chain)
|
||||
|
||||
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue