Skip to content

Commit 2d5d01f

Browse files
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 4a31ed8) Co-authored-by: Victor Stinner <[email protected]>
1 parent 502dba0 commit 2d5d01f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/test/pythoninfo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,10 @@ def format_attr(attr, value):
532532

533533

534534
def collect_socket(info_add):
535-
import socket
535+
try:
536+
import socket
537+
except ImportError:
538+
return
536539

537540
hostname = socket.gethostname()
538541
info_add('socket.hostname', hostname)

0 commit comments

Comments
 (0)