[3.11] gh-96320: WASI socket fixes (GH-96388) (GH-#96748)

- ignore missing functions in ``socket.__repr__``
- bundle network files with assets
This commit is contained in:
Miss Islington (bot) 2022-09-13 03:05:25 -07:00 committed by GitHub
parent 14adf4667e
commit 390123b412
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View file

@ -254,17 +254,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