diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-05-28 05:52:03 -0700 |
---|---|---|
committer | Petr Viktorin <encukou@gmail.com> | 2018-05-28 14:52:03 +0200 |
commit | 983c1ba94aef945386001932c5744f8ce9757fec (patch) | |
tree | 9d0974be0fe8786d04b2832565d7ae383c645b8b | |
parent | bpo-33400: Clarified documentation to indicate no strict adherence to ISO 860... (diff) | |
download | cpython-983c1ba94aef945386001932c5744f8ce9757fec.tar.gz cpython-983c1ba94aef945386001932c5744f8ce9757fec.tar.bz2 cpython-983c1ba94aef945386001932c5744f8ce9757fec.zip |
bpo-32374: Ignore Python-level exceptions in test_bad_traverse (GH-7145) (GH-7150)
(cherry picked from commit 08c5aca9d13b24b35faf89ebd26fc348ae1731b2)
Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
-rw-r--r-- | Lib/test/test_importlib/extension/test_loader.py | 20 |
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 57ba7083d37..9ad05fadef2 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) |