File tree Expand file tree Collapse file tree
Lib/test/test_importlib/extension Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,13 +275,19 @@ def test_bad_traverse(self):
275275 (Multiphase initialization modules only)
276276 '''
277277 script = """if True:
278- from test import support
279- import importlib.util as util
280- spec = util.find_spec('_testmultiphase')
281- spec.name = '_testmultiphase_with_bad_traverse'
282-
283- with support.SuppressCrashReport():
284- m = spec.loader.create_module(spec)"""
278+ try:
279+ from test import support
280+ import importlib.util as util
281+ spec = util.find_spec('_testmultiphase')
282+ spec.name = '_testmultiphase_with_bad_traverse'
283+
284+ with support.SuppressCrashReport():
285+ m = spec.loader.create_module(spec)
286+ except:
287+ # Prevent Python-level exceptions from
288+ # ending the process with non-zero status
289+ # (We are testing for a crash in C-code)
290+ pass"""
285291 assert_python_failure ("-c" , script )
286292
287293
You can’t perform that action at this time.
0 commit comments