From cdf087a77a75a4a3828e7b3cd98e6c3aa0064b5e Mon Sep 17 00:00:00 2001 From: neonene <53406459+neonene@users.noreply.github.com> Date: Sat, 3 Aug 2024 22:15:26 +0900 Subject: [PATCH] gh-122334: Fix test_embed failure when missing _ssl module (GH-122630) (cherry picked from commit 50b36037518a8e7f7eee39b597d56b5b2756eb86) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com> Co-authored-by: Wulian233 <1055917385@qq.com> --- Lib/test/test_embed.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 5ce23223a0f97f..13713cf37b83a4 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -438,8 +438,12 @@ def test_getargs_reset_static_parser(self): # 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