Skip to content

Commit 7a5f190

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 a6ee7f9 commit 7a5f190

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
@@ -543,7 +543,10 @@ def format_attr(attr, value):
543543

544544

545545
def collect_socket(info_add):
546-
import socket
546+
try:
547+
import socket
548+
except ImportError:
549+
return
547550

548551
try:
549552
hostname = socket.gethostname()

0 commit comments

Comments
 (0)