mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-38530: Make sure that failing to generate suggestions on failure will not propagate exceptions (GH-25408)
This commit is contained in:
parent
0c4c436325
commit
e07f4ab26a
3 changed files with 19 additions and 7 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue