summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-08-30 04:36:11 (GMT)
committerGitHub <noreply@github.com>2022-08-30 04:36:11 (GMT)
commitd0b3d235dbc560ada459e386b6fa5b5ce1952c7e (patch)
treef6972b38ca1598487bb0c48403d803ec057ca418 /Lib
parent6d403e264a7dcd1544a91708f139c6dd8612204d (diff)
downloadcpython-d0b3d235dbc560ada459e386b6fa5b5ce1952c7e.zip
cpython-d0b3d235dbc560ada459e386b6fa5b5ce1952c7e.tar.gz
cpython-d0b3d235dbc560ada459e386b6fa5b5ce1952c7e.tar.bz2
gh-96320: WASI socket fixes (#96388)
* gh-96320: WASI socket fixes - ignore missing functions in ``socket.__repr__`` - bundle network files with assets * blurb
Diffstat (limited to 'Lib')
-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