gh-102799: use exception instance instead of sys.exc_info() (#102885)

This commit is contained in:
Irit Katriel 2023-03-31 11:23:02 +01:00 committed by GitHub
parent c1e71ce56f
commit 44bd3fe570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 17 deletions

View file

@ -173,8 +173,8 @@ else: #pragma: no cover
"""Return the frame object for the caller's stack frame."""
try:
raise Exception
except Exception:
return sys.exc_info()[2].tb_frame.f_back
except Exception as exc:
return exc.__traceback__.tb_frame.f_back
#
# _srcfile is used when walking the stack to check when we've got the first