mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-102799: use exception instance instead of sys.exc_info() (#102885)
This commit is contained in:
parent
c1e71ce56f
commit
44bd3fe570
7 changed files with 16 additions and 17 deletions
|
@ -79,11 +79,11 @@ class Nested(object):
|
|||
try:
|
||||
if mgr.__exit__(*ex):
|
||||
ex = (None, None, None)
|
||||
except:
|
||||
ex = sys.exc_info()
|
||||
except BaseException as e:
|
||||
ex = (type(e), e, e.__traceback__)
|
||||
self.entered = None
|
||||
if ex is not exc_info:
|
||||
raise ex[0](ex[1]).with_traceback(ex[2])
|
||||
raise ex
|
||||
|
||||
|
||||
class MockNested(Nested):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue