work around GraalPy's broken inet_pton on Java backend

This commit is contained in:
Skye 2026-02-09 10:11:21 +09:00
parent a368fc66b3
commit 821a509064
No known key found for this signature in database
GPG key ID: 0104BC05F41B77B8

View file

@ -270,6 +270,20 @@ try:
socket.inet_pton(socket.AF_INET6, "::1") socket.inet_pton(socket.AF_INET6, "::1")
HAVE_IPV6 = True HAVE_IPV6 = True
if GRAAL:
try:
# --python.PosixModuleBackend=java throws OSError: illegal IP address
socket.inet_pton(socket.AF_INET, "127.0.0.1")
except:
_inet_pton = socket.inet_pton
def inet_pton(fam, ip):
if fam == socket.AF_INET:
return socket.inet_aton(ip)
return _inet_pton(fam, ip)
socket.inet_pton = inet_pton
except: except:
def inet_pton(fam, ip): def inet_pton(fam, ip):