mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-99947: Ensure unreported errors are chained for SystemError during import (GH-99946)
This commit is contained in:
parent
a68e585c8b
commit
474220e3a5
4 changed files with 13 additions and 7 deletions
|
@ -351,9 +351,14 @@ class MultiPhaseExtensionModuleTests(abc.LoaderTests):
|
|||
]:
|
||||
with self.subTest(name_base):
|
||||
name = self.name + '_' + name_base
|
||||
with self.assertRaises(SystemError):
|
||||
with self.assertRaises(SystemError) as cm:
|
||||
self.load_module_by_name(name)
|
||||
|
||||
# If there is an unreported exception, it should be chained
|
||||
# with the `SystemError`.
|
||||
if "unreported_exception" in name_base:
|
||||
self.assertIsNotNone(cm.exception.__cause__)
|
||||
|
||||
def test_nonascii(self):
|
||||
# Test that modules with non-ASCII names can be loaded.
|
||||
# punycode behaves slightly differently in some-ASCII and no-ASCII
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue