summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/extension
diff options
context:
space:
mode:
authorMarcel Plch <gmarcel.plch@gmail.com>2018-05-28 12:11:20 (GMT)
committerPetr Viktorin <encukou@gmail.com>2018-05-28 12:11:20 (GMT)
commit08c5aca9d13b24b35faf89ebd26fc348ae1731b2 (patch)
tree43291393c61ec3b5499ab656eaa6f51d9d707b8e /Lib/test/test_importlib/extension
parent97b523db7c79c18c48516fba9410014d9896abc4 (diff)
downloadcpython-08c5aca9d13b24b35faf89ebd26fc348ae1731b2.zip
cpython-08c5aca9d13b24b35faf89ebd26fc348ae1731b2.tar.gz
cpython-08c5aca9d13b24b35faf89ebd26fc348ae1731b2.tar.bz2
bpo-32374: Ignore Python-level exceptions in test_bad_traverse (GH-7145)
Diffstat (limited to 'Lib/test/test_importlib/extension')
-rw-r--r--Lib/test/test_importlib/extension/test_loader.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py
index 57ba708..9ad05fa 100644
--- a/Lib/test/test_importlib/extension/test_loader.py
+++ b/Lib/test/test_importlib/extension/test_loader.py
@@ -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'
-
- with support.SuppressCrashReport():
- m = spec.loader.create_module(spec)"""
+ 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)
+ 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)