summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorIrit Katriel <iritkatriel@yahoo.com>2021-02-23 17:43:04 (GMT)
committerGitHub <noreply@github.com>2021-02-23 17:43:04 (GMT)
commitb798ab06937f8bb24b444a49dd42e11fff15e654 (patch)
treec1f19563b4aa8a307f3763fc70731dc004ed0c02 /Lib/traceback.py
parent26f18b8540b49d592af66361f8df1a03953d1768 (diff)
downloadcpython-b798ab06937f8bb24b444a49dd42e11fff15e654.zip
cpython-b798ab06937f8bb24b444a49dd42e11fff15e654.tar.gz
cpython-b798ab06937f8bb24b444a49dd42e11fff15e654.tar.bz2
bpo-43146: fix None-handling in single-arg traceback.print_exception(None) (GH-24629)
(The previous commit fixed print_exception(None, None, None).)
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index dfb296c..8f908dd 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -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