From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:59:55 +0000 (+0200) Subject: [3.12] gh-122334: Fix test_embed failure when missing _ssl module (GH-122630) (#122648) X-Git-Tag: v3.12.5~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b895f1804ffd220768d2caff23363740bd2c9b01;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-122334: Fix test_embed failure when missing _ssl module (GH-122630) (#122648) 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> --- diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 5ce23223a0f9..13713cf37b83 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -438,8 +438,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