From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 25 May 2022 00:41:02 +0000 (-0700) Subject: test.pythoninfo no longer requires socket (GH-93191) X-Git-Tag: v3.11.0b2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a5f190c9fa7c6cbd334dfea9ae6032ac886dd89;p=thirdparty%2FPython%2Fcpython.git test.pythoninfo no longer requires socket (GH-93191) test.pythoninfo no longer fails if "import socket" fails: the socket module is now optional. (cherry picked from commit 4a31ed8a32699973ae1f779022794fdab9fa08ee) Co-authored-by: Victor Stinner --- diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index 84e1c047f921..eadc87a052c4 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -543,7 +543,10 @@ def collect_ssl(info_add): def collect_socket(info_add): - import socket + try: + import socket + except ImportError: + return try: hostname = socket.gethostname()