mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-43146: fix None-handling in single-arg traceback.print_exception(None) (GH-24629)
(The previous commit fixed print_exception(None, None, None).)
This commit is contained in:
parent
26f18b8540
commit
b798ab0693
3 changed files with 10 additions and 1 deletions
|
@ -91,7 +91,10 @@ def _parse_value_tb(exc, value, tb):
|
|||
if (value is _sentinel) != (tb is _sentinel):
|
||||
raise ValueError("Both or neither of value and tb must be given")
|
||||
if value is tb is _sentinel:
|
||||
return exc, exc.__traceback__
|
||||
if exc is not None:
|
||||
return exc, exc.__traceback__
|
||||
else:
|
||||
return None, None
|
||||
return value, tb
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue