]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-122334: Fix test_embed failure when missing _ssl module (GH-122630)
authorneonene <53406459+neonene@users.noreply.github.com>
Sat, 3 Aug 2024 13:15:26 +0000 (22:15 +0900)
committerGitHub <noreply@github.com>
Sat, 3 Aug 2024 13:15:26 +0000 (15:15 +0200)
Co-authored-by: Wulian233 <1055917385@qq.com>
Lib/test/test_embed.py

index ab112d6be85b46bf40801db419cf8146164958cd..916a9a79887dfc87825e14ff88669d30eecf7fad 100644 (file)
@@ -465,8 +465,12 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
         # Test _PyArg_Parser initializations via _PyArg_UnpackKeywords()
         # https://github.com/python/cpython/issues/122334
         code = textwrap.dedent("""
-            import _ssl
-            _ssl.txt2obj(txt='1.3')
+            try:
+                import _ssl
+            except ModuleNotFoundError:
+                _ssl = None
+            if _ssl is not None:
+                _ssl.txt2obj(txt='1.3')
             print('1')
 
             import _queue