bpo-32374: Ignore Python-level exceptions in test_bad_traverse (GH-7145)

(cherry picked from commit 08c5aca9d1)

Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-05-28 09:37:10 -07:00 committed by GitHub
parent ae27dee0f8
commit 6ec325d483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -275,13 +275,19 @@ class MultiPhaseExtensionModuleTests(abc.LoaderTests):
(Multiphase initialization modules only)
'''
script = """if True:
from test import support
import importlib.util as util
spec = util.find_spec('_testmultiphase')
spec.name = '_testmultiphase_with_bad_traverse'
try:
from test import support
import importlib.util as util
spec = util.find_spec('_testmultiphase')
spec.name = '_testmultiphase_with_bad_traverse'
with support.SuppressCrashReport():
m = spec.loader.create_module(spec)"""
with support.SuppressCrashReport():
m = spec.loader.create_module(spec)
except:
# Prevent Python-level exceptions from
# ending the process with non-zero status
# (We are testing for a crash in C-code)
pass"""
assert_python_failure("-c", script)