summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-25 00:11:51 (GMT)
committerGitHub <noreply@github.com>2022-05-25 00:11:51 (GMT)
commit4a31ed8a32699973ae1f779022794fdab9fa08ee (patch)
tree5ccb34fdd1298448d96a23d82cabae45b48bd7f4
parent32b7bcffba0e6f6c96d70cafbae1488c6bc36cbc (diff)
downloadcpython-4a31ed8a32699973ae1f779022794fdab9fa08ee.zip
cpython-4a31ed8a32699973ae1f779022794fdab9fa08ee.tar.gz
cpython-4a31ed8a32699973ae1f779022794fdab9fa08ee.tar.bz2
test.pythoninfo no longer requires socket (#93191)
test.pythoninfo no longer fails if "import socket" fails: the socket module is now optional.
-rw-r--r--Lib/test/pythoninfo.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index 84e1c04..eadc87a 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()