From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 25 May 2022 00:42:06 +0000 (-0700) Subject: test.pythoninfo no longer requires socket (GH-93191) X-Git-Tag: v3.10.5~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d5d01f26ba7939e8a035b6fe7abcc8490c9f208;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 8c8011b550ac..005eae549cb0 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -532,7 +532,10 @@ def collect_ssl(info_add): def collect_socket(info_add): - import socket + try: + import socket + except ImportError: + return hostname = socket.gethostname() info_add('socket.hostname', hostname)