bpo-46411: Remove unnecessary calls to sys.exc_info() in tests (GH-30638)
(cherry picked from commit a287b31bcb065e4122400cb59167340d25480e6d)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
index 8dc62a9..8225504 100644
--- a/Lib/test/test_raise.py
+++ b/Lib/test/test_raise.py
@@ -12,8 +12,8 @@
def get_tb():
try:
raise OSError()
- except:
- return sys.exc_info()[2]
+ except OSError as e:
+ return e.__traceback__
class Context: