Skip to content

Commit

Permalink
test.pythoninfo no longer requires socket (GH-93191)
Browse files Browse the repository at this point in the history
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 <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner committed May 25, 2022
1 parent 502dba0 commit 2d5d01f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,10 @@ def format_attr(attr, value):


def collect_socket(info_add):
import socket
try:
import socket
except ImportError:
return

hostname = socket.gethostname()
info_add('socket.hostname', hostname)
Expand Down

0 comments on commit 2d5d01f

Please sign in to comment.