gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293)

This commit is contained in:
Irit Katriel 2023-04-06 11:08:25 +01:00 committed by GitHub
parent a44568b80d
commit 482b6eeadc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 68 additions and 71 deletions

View file

@ -537,10 +537,11 @@ class dispatcher_with_send(dispatcher):
# ---------------------------------------------------------------------------
def compact_traceback():
t, v, tb = sys.exc_info()
tbinfo = []
exc = sys.exception()
tb = exc.__traceback__
if not tb: # Must have a traceback
raise AssertionError("traceback does not exist")
tbinfo = []
while tb:
tbinfo.append((
tb.tb_frame.f_code.co_filename,
@ -554,7 +555,7 @@ def compact_traceback():
file, function, line = tbinfo[-1]
info = ' '.join(['[%s|%s|%s]' % x for x in tbinfo])
return (file, function, line), t, v, info
return (file, function, line), type(exc), exc, info
def close_all(map=None, ignore_all=False):
if map is None: