diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-14 17:58:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 17:58:28 (GMT) |
commit | e07f4ab26aaf08f90ebd9e6004af14fd6ef39351 (patch) | |
tree | 65903b0467e6fa1eb88b76f0adb17927f8d61e74 /Lib/test | |
parent | 0c4c43632556a5ea5ef2267efeb17b332b861a19 (diff) | |
download | cpython-e07f4ab26aaf08f90ebd9e6004af14fd6ef39351.zip cpython-e07f4ab26aaf08f90ebd9e6004af14fd6ef39351.tar.gz cpython-e07f4ab26aaf08f90ebd9e6004af14fd6ef39351.tar.bz2 |
bpo-38530: Make sure that failing to generate suggestions on failure will not propagate exceptions (GH-25408)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_exceptions.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 4f3c9ab..ebeb67b 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1695,6 +1695,20 @@ class AttributeErrorTests(unittest.TestCase): self.assertIn("blech", err.getvalue()) + def test_attribute_error_with_failing_dict(self): + class T: + bluch = 1 + def __dir__(self): + raise AttributeError("oh no!") + + try: + T().blich + except AttributeError as exc: + with support.captured_stderr() as err: + sys.__excepthook__(*sys.exc_info()) + + self.assertNotIn("blech", err.getvalue()) + self.assertNotIn("oh no!", err.getvalue()) class ImportErrorTests(unittest.TestCase): |