summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 0ed86af..1c8cef6 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -255,17 +255,18 @@ class socket(_socket.socket):
self.type,
self.proto)
if not closed:
+ # getsockname and getpeername may not be available on WASI.
try:
laddr = self.getsockname()
if laddr:
s += ", laddr=%s" % str(laddr)
- except error:
+ except (error, AttributeError):
pass
try:
raddr = self.getpeername()
if raddr:
s += ", raddr=%s" % str(raddr)
- except error:
+ except (error, AttributeError):
pass
s += '>'
return s