Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1952868

Browse files
committedMar 17, 2023
pythongh-102799: remove unnecessary calls to sys.exc_info() in tests
1 parent 3cb1bf2 commit 1952868

File tree

5 files changed

+124
-124
lines changed

5 files changed

+124
-124
lines changed
 

‎Lib/test/test_asyncio/test_unix_events.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1889,8 +1889,8 @@ async def test_fork_not_share_event_loop(self):
18891889
os.write(w, b'LOOP:' + str(id(loop)).encode())
18901890
except RuntimeError:
18911891
os.write(w, b'NO LOOP')
1892-
except:
1893-
os.write(w, b'ERROR:' + ascii(sys.exc_info()).encode())
1892+
except BaseException as e:
1893+
os.write(w, b'ERROR:' + ascii(e).encode())
18941894
finally:
18951895
os._exit(0)
18961896
else:

‎Lib/test/test_exceptions.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ def test_notes(self):
599599
def testWithTraceback(self):
600600
try:
601601
raise IndexError(4)
602-
except:
603-
tb = sys.exc_info()[2]
602+
except Exception as e:
603+
tb = e.__traceback__
604604

605605
e = BaseException().with_traceback(tb)
606606
self.assertIsInstance(e, BaseException)
@@ -653,8 +653,8 @@ def test_invalid_delattr(self):
653653
def testNoneClearsTracebackAttr(self):
654654
try:
655655
raise IndexError(4)
656-
except:
657-
tb = sys.exc_info()[2]
656+
except Exception as e:
657+
tb = e.__traceback__
658658

659659
e = Exception()
660660
e.__traceback__ = tb
@@ -1337,11 +1337,11 @@ class MyException(Exception, metaclass=Meta):
13371337
def g():
13381338
try:
13391339
return g()
1340-
except RecursionError:
1341-
return sys.exc_info()
1342-
e, v, tb = g()
1343-
self.assertIsInstance(v, RecursionError, type(v))
1344-
self.assertIn("maximum recursion depth exceeded", str(v))
1340+
except RecursionError as e:
1341+
return e
1342+
exc = g()
1343+
self.assertIsInstance(exc, RecursionError, type(exc))
1344+
self.assertIn("maximum recursion depth exceeded", str(exc))
13451345

13461346

13471347
@cpython_only

‎Lib/test/test_socket.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5492,10 +5492,10 @@ def alarm_handler(signal, frame):
54925492
self.fail("caught timeout instead of Alarm")
54935493
except Alarm:
54945494
pass
5495-
except:
5495+
except BaseException as e:
54965496
self.fail("caught other exception instead of Alarm:"
54975497
" %s(%s):\n%s" %
5498-
(sys.exc_info()[:2] + (traceback.format_exc(),)))
5498+
(type(e), e, traceback.format_exc()))
54995499
else:
55005500
self.fail("nothing caught")
55015501
finally:

‎Lib/test/test_sys.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1649,8 +1649,8 @@ def test_pythontypes(self):
16491649
check(_ast.AST(), size('P'))
16501650
try:
16511651
raise TypeError
1652-
except TypeError:
1653-
tb = sys.exc_info()[2]
1652+
except TypeError as e:
1653+
tb = e.__traceback__
16541654
# traceback
16551655
if tb is not None:
16561656
check(tb, size('2P2i'))

‎Lib/test/test_traceback.py

+109-109
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,15 @@ class PrintExceptionAtExit(object):
296296
def __init__(self):
297297
try:
298298
x = 1 / 0
299-
except Exception:
300-
self.exc_info = sys.exc_info()
301-
# self.exc_info[1] (traceback) contains frames:
299+
except Exception as e:
300+
self.exc = e
301+
# self.exc.__traceback__ contains frames:
302302
# explicitly clear the reference to self in the current
303303
# frame to break a reference cycle
304304
self = None
305305
306306
def __del__(self):
307-
traceback.print_exception(*self.exc_info)
307+
traceback.print_exception(self.exc)
308308
309309
# Keep a reference in the module namespace to call the destructor
310310
# when the module is unloaded
@@ -923,8 +923,8 @@ def check_traceback_format(self, cleanup_func=None):
923923
from _testcapi import traceback_print
924924
try:
925925
self.some_exception()
926-
except KeyError:
927-
type_, value, tb = sys.exc_info()
926+
except KeyError as e:
927+
tb = e.__traceback__
928928
if cleanup_func is not None:
929929
# Clear the inner frames, not this one
930930
cleanup_func(tb.tb_next)
@@ -1228,8 +1228,8 @@ def __eq__(self, other):
12281228
except UnhashableException:
12291229
try:
12301230
raise ex1
1231-
except UnhashableException:
1232-
exc_type, exc_val, exc_tb = sys.exc_info()
1231+
except UnhashableException as e:
1232+
exc_val = e
12331233

12341234
with captured_output("stderr") as stderr_f:
12351235
exception_print(exc_val)
@@ -2133,8 +2133,8 @@ def assertEqualExcept(actual, expected, ignore):
21332133
def test_extract_tb(self):
21342134
try:
21352135
self.last_raises5()
2136-
except Exception:
2137-
exc_type, exc_value, tb = sys.exc_info()
2136+
except Exception as e:
2137+
tb = e.__traceback__
21382138
def extract(**kwargs):
21392139
return traceback.extract_tb(tb, **kwargs)
21402140

@@ -2160,12 +2160,12 @@ def extract(**kwargs):
21602160
def test_format_exception(self):
21612161
try:
21622162
self.last_raises5()
2163-
except Exception:
2164-
exc_type, exc_value, tb = sys.exc_info()
2163+
except Exception as e:
2164+
exc = e
21652165
# [1:-1] to exclude "Traceback (...)" header and
21662166
# exception type and value
21672167
def extract(**kwargs):
2168-
return traceback.format_exception(exc_type, exc_value, tb, **kwargs)[1:-1]
2168+
return traceback.format_exception(exc, **kwargs)[1:-1]
21692169

21702170
with support.swap_attr(sys, 'tracebacklimit', 1000):
21712171
nolim = extract()
@@ -2203,8 +2203,8 @@ def inner():
22032203

22042204
try:
22052205
outer()
2206-
except:
2207-
type_, value, tb = sys.exc_info()
2206+
except BaseException as e:
2207+
tb = e.__traceback__
22082208

22092209
# Initial assertion: there's one local in the inner frame.
22102210
inner_frame = tb.tb_next.tb_next.tb_next.tb_frame
@@ -2282,8 +2282,8 @@ def deeper():
22822282
def test_walk_tb(self):
22832283
try:
22842284
1/0
2285-
except Exception:
2286-
_, _, tb = sys.exc_info()
2285+
except Exception as e:
2286+
tb = e.__traceback__
22872287
s = list(traceback.walk_tb(tb))
22882288
self.assertEqual(len(s), 1)
22892289

@@ -2386,10 +2386,10 @@ def f():
23862386
def g():
23872387
try:
23882388
f()
2389-
except:
2390-
return sys.exc_info()
2389+
except Exception as e:
2390+
return e.__traceback__
23912391

2392-
exc_info = g()
2392+
tb = g()
23932393

23942394
class Skip_G(traceback.StackSummary):
23952395
def format_frame_summary(self, frame_summary):
@@ -2398,7 +2398,7 @@ def format_frame_summary(self, frame_summary):
23982398
return super().format_frame_summary(frame_summary)
23992399

24002400
stack = Skip_G.extract(
2401-
traceback.walk_tb(exc_info[2])).format()
2401+
traceback.walk_tb(tb)).format()
24022402

24032403
self.assertEqual(len(stack), 1)
24042404
lno = f.__code__.co_firstlineno + 1
@@ -2416,17 +2416,17 @@ class TestTracebackException(unittest.TestCase):
24162416
def test_smoke(self):
24172417
try:
24182418
1/0
2419-
except Exception:
2420-
exc_info = sys.exc_info()
2421-
exc = traceback.TracebackException(*exc_info)
2419+
except Exception as e:
2420+
exc_obj = e
2421+
exc = traceback.TracebackException.from_exception(e)
24222422
expected_stack = traceback.StackSummary.extract(
2423-
traceback.walk_tb(exc_info[2]))
2423+
traceback.walk_tb(e.__traceback__))
24242424
self.assertEqual(None, exc.__cause__)
24252425
self.assertEqual(None, exc.__context__)
24262426
self.assertEqual(False, exc.__suppress_context__)
24272427
self.assertEqual(expected_stack, exc.stack)
2428-
self.assertEqual(exc_info[0], exc.exc_type)
2429-
self.assertEqual(str(exc_info[1]), str(exc))
2428+
self.assertEqual(type(exc_obj), exc.exc_type)
2429+
self.assertEqual(str(exc_obj), str(exc))
24302430

24312431
def test_from_exception(self):
24322432
# Check all the parameters are accepted.
@@ -2435,9 +2435,10 @@ def foo():
24352435
try:
24362436
foo()
24372437
except Exception as e:
2438-
exc_info = sys.exc_info()
2438+
exc_obj = e
2439+
tb = e.__traceback__
24392440
self.expected_stack = traceback.StackSummary.extract(
2440-
traceback.walk_tb(exc_info[2]), limit=1, lookup_lines=False,
2441+
traceback.walk_tb(tb), limit=1, lookup_lines=False,
24412442
capture_locals=True)
24422443
self.exc = traceback.TracebackException.from_exception(
24432444
e, limit=1, lookup_lines=False, capture_locals=True)
@@ -2447,8 +2448,8 @@ def foo():
24472448
self.assertEqual(None, exc.__context__)
24482449
self.assertEqual(False, exc.__suppress_context__)
24492450
self.assertEqual(expected_stack, exc.stack)
2450-
self.assertEqual(exc_info[0], exc.exc_type)
2451-
self.assertEqual(str(exc_info[1]), str(exc))
2451+
self.assertEqual(type(exc_obj), exc.exc_type)
2452+
self.assertEqual(str(exc_obj), str(exc))
24522453

24532454
def test_cause(self):
24542455
try:
@@ -2459,18 +2460,18 @@ def test_cause(self):
24592460
exc_context = traceback.TracebackException(*exc_info_context)
24602461
cause = Exception("cause")
24612462
raise Exception("uh oh") from cause
2462-
except Exception:
2463-
exc_info = sys.exc_info()
2464-
exc = traceback.TracebackException(*exc_info)
2463+
except Exception as e:
2464+
exc_obj = e
2465+
exc = traceback.TracebackException.from_exception(e)
24652466
expected_stack = traceback.StackSummary.extract(
2466-
traceback.walk_tb(exc_info[2]))
2467+
traceback.walk_tb(e.__traceback__))
24672468
exc_cause = traceback.TracebackException(Exception, cause, None)
24682469
self.assertEqual(exc_cause, exc.__cause__)
24692470
self.assertEqual(exc_context, exc.__context__)
24702471
self.assertEqual(True, exc.__suppress_context__)
24712472
self.assertEqual(expected_stack, exc.stack)
2472-
self.assertEqual(exc_info[0], exc.exc_type)
2473-
self.assertEqual(str(exc_info[1]), str(exc))
2473+
self.assertEqual(type(exc_obj), exc.exc_type)
2474+
self.assertEqual(str(exc_obj), str(exc))
24742475

24752476
def test_context(self):
24762477
try:
@@ -2480,17 +2481,17 @@ def test_context(self):
24802481
exc_info_context = sys.exc_info()
24812482
exc_context = traceback.TracebackException(*exc_info_context)
24822483
raise Exception("uh oh")
2483-
except Exception:
2484-
exc_info = sys.exc_info()
2485-
exc = traceback.TracebackException(*exc_info)
2484+
except Exception as e:
2485+
exc_obj = e
2486+
exc = traceback.TracebackException.from_exception(e)
24862487
expected_stack = traceback.StackSummary.extract(
2487-
traceback.walk_tb(exc_info[2]))
2488+
traceback.walk_tb(e.__traceback__))
24882489
self.assertEqual(None, exc.__cause__)
24892490
self.assertEqual(exc_context, exc.__context__)
24902491
self.assertEqual(False, exc.__suppress_context__)
24912492
self.assertEqual(expected_stack, exc.stack)
2492-
self.assertEqual(exc_info[0], exc.exc_type)
2493-
self.assertEqual(str(exc_info[1]), str(exc))
2493+
self.assertEqual(type(exc_obj), exc.exc_type)
2494+
self.assertEqual(str(exc_obj), str(exc))
24942495

24952496
def test_long_context_chain(self):
24962497
def f():
@@ -2501,12 +2502,12 @@ def f():
25012502

25022503
try:
25032504
f()
2504-
except RecursionError:
2505-
exc_info = sys.exc_info()
2505+
except RecursionError as e:
2506+
exc_obj = e
25062507
else:
25072508
self.fail("Exception not raised")
25082509

2509-
te = traceback.TracebackException(*exc_info)
2510+
te = traceback.TracebackException.from_exception(exc_obj)
25102511
res = list(te.format())
25112512

25122513
# many ZeroDiv errors followed by the RecursionError
@@ -2524,18 +2525,18 @@ def test_compact_with_cause(self):
25242525
finally:
25252526
cause = Exception("cause")
25262527
raise Exception("uh oh") from cause
2527-
except Exception:
2528-
exc_info = sys.exc_info()
2529-
exc = traceback.TracebackException(*exc_info, compact=True)
2528+
except Exception as e:
2529+
exc_obj = e
2530+
exc = traceback.TracebackException.from_exception(exc_obj, compact=True)
25302531
expected_stack = traceback.StackSummary.extract(
2531-
traceback.walk_tb(exc_info[2]))
2532+
traceback.walk_tb(exc_obj.__traceback__))
25322533
exc_cause = traceback.TracebackException(Exception, cause, None)
25332534
self.assertEqual(exc_cause, exc.__cause__)
25342535
self.assertEqual(None, exc.__context__)
25352536
self.assertEqual(True, exc.__suppress_context__)
25362537
self.assertEqual(expected_stack, exc.stack)
2537-
self.assertEqual(exc_info[0], exc.exc_type)
2538-
self.assertEqual(str(exc_info[1]), str(exc))
2538+
self.assertEqual(type(exc_obj), exc.exc_type)
2539+
self.assertEqual(str(exc_obj), str(exc))
25392540

25402541
def test_compact_no_cause(self):
25412542
try:
@@ -2545,37 +2546,37 @@ def test_compact_no_cause(self):
25452546
exc_info_context = sys.exc_info()
25462547
exc_context = traceback.TracebackException(*exc_info_context)
25472548
raise Exception("uh oh")
2548-
except Exception:
2549-
exc_info = sys.exc_info()
2550-
exc = traceback.TracebackException(*exc_info, compact=True)
2549+
except Exception as e:
2550+
exc_obj = e
2551+
exc = traceback.TracebackException.from_exception(e, compact=True)
25512552
expected_stack = traceback.StackSummary.extract(
2552-
traceback.walk_tb(exc_info[2]))
2553+
traceback.walk_tb(exc_obj.__traceback__))
25532554
self.assertEqual(None, exc.__cause__)
25542555
self.assertEqual(exc_context, exc.__context__)
25552556
self.assertEqual(False, exc.__suppress_context__)
25562557
self.assertEqual(expected_stack, exc.stack)
2557-
self.assertEqual(exc_info[0], exc.exc_type)
2558-
self.assertEqual(str(exc_info[1]), str(exc))
2558+
self.assertEqual(type(exc_obj), exc.exc_type)
2559+
self.assertEqual(str(exc_obj), str(exc))
25592560

25602561
def test_no_refs_to_exception_and_traceback_objects(self):
25612562
try:
25622563
1/0
2563-
except Exception:
2564-
exc_info = sys.exc_info()
2564+
except Exception as e:
2565+
exc_obj = e
25652566

2566-
refcnt1 = sys.getrefcount(exc_info[1])
2567-
refcnt2 = sys.getrefcount(exc_info[2])
2568-
exc = traceback.TracebackException(*exc_info)
2569-
self.assertEqual(sys.getrefcount(exc_info[1]), refcnt1)
2570-
self.assertEqual(sys.getrefcount(exc_info[2]), refcnt2)
2567+
refcnt1 = sys.getrefcount(exc_obj)
2568+
refcnt2 = sys.getrefcount(exc_obj.__traceback__)
2569+
exc = traceback.TracebackException.from_exception(exc_obj)
2570+
self.assertEqual(sys.getrefcount(exc_obj), refcnt1)
2571+
self.assertEqual(sys.getrefcount(exc_obj.__traceback__), refcnt2)
25712572

25722573
def test_comparison_basic(self):
25732574
try:
25742575
1/0
2575-
except Exception:
2576-
exc_info = sys.exc_info()
2577-
exc = traceback.TracebackException(*exc_info)
2578-
exc2 = traceback.TracebackException(*exc_info)
2576+
except Exception as e:
2577+
exc_obj = e
2578+
exc = traceback.TracebackException.from_exception(exc_obj)
2579+
exc2 = traceback.TracebackException.from_exception(exc_obj)
25792580
self.assertIsNot(exc, exc2)
25802581
self.assertEqual(exc, exc2)
25812582
self.assertNotEqual(exc, object())
@@ -2594,37 +2595,37 @@ def raise_with_locals():
25942595

25952596
try:
25962597
raise_with_locals()
2597-
except Exception:
2598-
exc_info = sys.exc_info()
2598+
except Exception as e:
2599+
exc_obj = e
25992600

2600-
exc = traceback.TracebackException(*exc_info)
2601-
exc1 = traceback.TracebackException(*exc_info, limit=10)
2602-
exc2 = traceback.TracebackException(*exc_info, limit=2)
2601+
exc = traceback.TracebackException.from_exception(exc_obj)
2602+
exc1 = traceback.TracebackException.from_exception(exc_obj, limit=10)
2603+
exc2 = traceback.TracebackException.from_exception(exc_obj, limit=2)
26032604

26042605
self.assertEqual(exc, exc1) # limit=10 gets all frames
26052606
self.assertNotEqual(exc, exc2) # limit=2 truncates the output
26062607

26072608
# locals change the output
2608-
exc3 = traceback.TracebackException(*exc_info, capture_locals=True)
2609+
exc3 = traceback.TracebackException.from_exception(exc_obj, capture_locals=True)
26092610
self.assertNotEqual(exc, exc3)
26102611

26112612
# there are no locals in the innermost frame
2612-
exc4 = traceback.TracebackException(*exc_info, limit=-1)
2613-
exc5 = traceback.TracebackException(*exc_info, limit=-1, capture_locals=True)
2613+
exc4 = traceback.TracebackException.from_exception(exc_obj, limit=-1)
2614+
exc5 = traceback.TracebackException.from_exception(exc_obj, limit=-1, capture_locals=True)
26142615
self.assertEqual(exc4, exc5)
26152616

26162617
# there are locals in the next-to-innermost frame
2617-
exc6 = traceback.TracebackException(*exc_info, limit=-2)
2618-
exc7 = traceback.TracebackException(*exc_info, limit=-2, capture_locals=True)
2618+
exc6 = traceback.TracebackException.from_exception(exc_obj, limit=-2)
2619+
exc7 = traceback.TracebackException.from_exception(exc_obj, limit=-2, capture_locals=True)
26192620
self.assertNotEqual(exc6, exc7)
26202621

26212622
def test_comparison_equivalent_exceptions_are_equal(self):
26222623
excs = []
26232624
for _ in range(2):
26242625
try:
26252626
1/0
2626-
except:
2627-
excs.append(traceback.TracebackException(*sys.exc_info()))
2627+
except Exception as e:
2628+
excs.append(traceback.TracebackException.from_exception(e))
26282629
self.assertEqual(excs[0], excs[1])
26292630
self.assertEqual(list(excs[0].format()), list(excs[1].format()))
26302631

@@ -2640,9 +2641,9 @@ def __eq__(self, other):
26402641
except UnhashableException:
26412642
try:
26422643
raise ex1
2643-
except UnhashableException:
2644-
exc_info = sys.exc_info()
2645-
exc = traceback.TracebackException(*exc_info)
2644+
except UnhashableException as e:
2645+
exc_obj = e
2646+
exc = traceback.TracebackException.from_exception(exc_obj)
26462647
formatted = list(exc.format())
26472648
self.assertIn('UnhashableException: ex2\n', formatted[2])
26482649
self.assertIn('UnhashableException: ex1\n', formatted[6])
@@ -2655,11 +2656,10 @@ def recurse(n):
26552656
1/0
26562657
try:
26572658
recurse(10)
2658-
except Exception:
2659-
exc_info = sys.exc_info()
2660-
exc = traceback.TracebackException(*exc_info, limit=5)
2659+
except Exception as e:
2660+
exc = traceback.TracebackException.from_exception(e, limit=5)
26612661
expected_stack = traceback.StackSummary.extract(
2662-
traceback.walk_tb(exc_info[2]), limit=5)
2662+
traceback.walk_tb(e.__traceback__), limit=5)
26632663
self.assertEqual(expected_stack, exc.stack)
26642664

26652665
def test_lookup_lines(self):
@@ -2706,9 +2706,9 @@ def f():
27062706
x = 12
27072707
try:
27082708
x/0
2709-
except Exception:
2710-
return sys.exc_info()
2711-
exc = traceback.TracebackException(*f(), capture_locals=True)
2709+
except Exception as e:
2710+
return e
2711+
exc = traceback.TracebackException.from_exception(f(), capture_locals=True)
27122712
output = StringIO()
27132713
exc.print(file=output)
27142714
self.assertEqual(
@@ -2723,7 +2723,7 @@ def f():
27232723
class TestTracebackException_ExceptionGroups(unittest.TestCase):
27242724
def setUp(self):
27252725
super().setUp()
2726-
self.eg_info = self._get_exception_group()
2726+
self.eg = self._get_exception_group()
27272727

27282728
def _get_exception_group(self):
27292729
def f():
@@ -2753,26 +2753,26 @@ def g(v):
27532753
except Exception as e:
27542754
exc4 = e
27552755
raise ExceptionGroup("eg2", [exc3, exc4])
2756-
except ExceptionGroup:
2757-
return sys.exc_info()
2756+
except ExceptionGroup as eg:
2757+
return eg
27582758
self.fail('Exception Not Raised')
27592759

27602760
def test_exception_group_construction(self):
2761-
eg_info = self.eg_info
2762-
teg1 = traceback.TracebackException(*eg_info)
2763-
teg2 = traceback.TracebackException.from_exception(eg_info[1])
2761+
eg = self.eg
2762+
teg1 = traceback.TracebackException(type(eg), eg, eg.__traceback__)
2763+
teg2 = traceback.TracebackException.from_exception(eg)
27642764
self.assertIsNot(teg1, teg2)
27652765
self.assertEqual(teg1, teg2)
27662766

27672767
def test_exception_group_format_exception_only(self):
2768-
teg = traceback.TracebackException(*self.eg_info)
2768+
teg = traceback.TracebackException.from_exception(self.eg)
27692769
formatted = ''.join(teg.format_exception_only()).split('\n')
27702770
expected = "ExceptionGroup: eg2 (2 sub-exceptions)\n".split('\n')
27712771

27722772
self.assertEqual(formatted, expected)
27732773

27742774
def test_exception_group_format(self):
2775-
teg = traceback.TracebackException(*self.eg_info)
2775+
teg = traceback.TracebackException.from_exception(self.eg)
27762776

27772777
formatted = ''.join(teg.format()).split('\n')
27782778
lno_f = self.lno_f
@@ -2884,18 +2884,18 @@ def test_max_group_depth(self):
28842884

28852885
def test_comparison(self):
28862886
try:
2887-
raise self.eg_info[1]
2888-
except ExceptionGroup:
2889-
exc_info = sys.exc_info()
2887+
raise self.eg
2888+
except ExceptionGroup as e:
2889+
exc = e
28902890
for _ in range(5):
28912891
try:
2892-
raise exc_info[1]
2893-
except:
2894-
exc_info = sys.exc_info()
2895-
exc = traceback.TracebackException(*exc_info)
2896-
exc2 = traceback.TracebackException(*exc_info)
2897-
exc3 = traceback.TracebackException(*exc_info, limit=300)
2898-
ne = traceback.TracebackException(*exc_info, limit=3)
2892+
raise exc
2893+
except Exception as e:
2894+
exc_obj = e
2895+
exc = traceback.TracebackException.from_exception(exc_obj)
2896+
exc2 = traceback.TracebackException.from_exception(exc_obj)
2897+
exc3 = traceback.TracebackException.from_exception(exc_obj, limit=300)
2898+
ne = traceback.TracebackException.from_exception(exc_obj, limit=3)
28992899
self.assertIsNot(exc, exc2)
29002900
self.assertEqual(exc, exc2)
29012901
self.assertEqual(exc, exc3)

0 commit comments

Comments
 (0)
Please sign in to comment.