diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/inspect_fodder.py | 10 | ||||
-rw-r--r-- | Lib/test/test_inspect.py | 2 | ||||
-rw-r--r-- | Lib/test/test_with.py | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/Lib/test/inspect_fodder.py b/Lib/test/inspect_fodder.py index e1287a3..567dfba 100644 --- a/Lib/test/inspect_fodder.py +++ b/Lib/test/inspect_fodder.py @@ -1,7 +1,7 @@ # line 1 'A module docstring.' -import sys, inspect +import inspect # line 5 # line 7 @@ -41,8 +41,8 @@ class StupidGit: def argue(self, a, b, c): try: spam(a, b, c) - except: - self.ex = sys.exc_info() + except BaseException as e: + self.ex = e self.tr = inspect.trace() @property @@ -78,8 +78,8 @@ async def lobbest(grenade): currentframe = inspect.currentframe() try: raise Exception() -except: - tb = sys.exc_info()[2] +except BaseException as e: + tb = e.__traceback__ class Callable: def __call__(self, *args): diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 803b259..3a3646f 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -430,7 +430,7 @@ class TestInterpreterStack(IsTestBase): git.abuse(7, 8, 9) def test_abuse_done(self): - self.istest(inspect.istraceback, 'git.ex[2]') + self.istest(inspect.istraceback, 'git.ex.__traceback__') self.istest(inspect.isframe, 'mod.fr') def test_stack(self): diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py index 07522bd..d819023 100644 --- a/Lib/test/test_with.py +++ b/Lib/test/test_with.py @@ -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): |