gh-95174: Handle missing waitpid and gethostbyname in WASI (GH-95181)

(cherry picked from commit 8184f0fce3)

Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
Miss Islington (bot) 2022-07-23 23:30:39 -07:00 committed by GitHub
parent 22f06d6ce3
commit 00cda6b530
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View file

@ -524,6 +524,8 @@ def _ip_getnode():
def _arp_getnode():
"""Get the hardware address on Unix by running arp."""
import os, socket
if not hasattr(socket, "gethostbyname"):
return None
try:
ip_addr = socket.gethostbyname(socket.gethostname())
except OSError: