]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
test.pythoninfo no longer requires socket (#93191)
authorVictor Stinner <vstinner@python.org>
Wed, 25 May 2022 00:11:51 +0000 (02:11 +0200)
committerGitHub <noreply@github.com>
Wed, 25 May 2022 00:11:51 +0000 (02:11 +0200)
test.pythoninfo no longer fails if "import socket" fails: the socket
module is now optional.

Lib/test/pythoninfo.py

index 84e1c047f921914f160981cbafc7e3e46c3a7d5d..eadc87a052c4abcf0f6ed447d8a201a228b52122 100644 (file)
@@ -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()