mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-45615: Add missing test for printing traceback for non-exception. Fix traceback.py (GH-30091)
This commit is contained in:
parent
a09bc3a404
commit
a82baed0e9
4 changed files with 28 additions and 7 deletions
|
@ -98,7 +98,11 @@ def _parse_value_tb(exc, value, tb):
|
|||
raise ValueError("Both or neither of value and tb must be given")
|
||||
if value is tb is _sentinel:
|
||||
if exc is not None:
|
||||
return exc, exc.__traceback__
|
||||
if isinstance(exc, BaseException):
|
||||
return exc, exc.__traceback__
|
||||
|
||||
raise TypeError(f'Exception expected for value, '
|
||||
f'{type(exc).__name__} found')
|
||||
else:
|
||||
return None, None
|
||||
return value, tb
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue