mirror of
https://github.com/python/cpython.git
synced 2025-12-20 15:41:13 +00:00
gh-96320: WASI socket fixes (#96388)
* gh-96320: WASI socket fixes - ignore missing functions in ``socket.__repr__`` - bundle network files with assets * blurb
This commit is contained in:
parent
6d403e264a
commit
d0b3d235db
3 changed files with 7 additions and 3 deletions
|
|
@ -255,17 +255,18 @@ class socket(_socket.socket):
|
||||||
self.type,
|
self.type,
|
||||||
self.proto)
|
self.proto)
|
||||||
if not closed:
|
if not closed:
|
||||||
|
# getsockname and getpeername may not be available on WASI.
|
||||||
try:
|
try:
|
||||||
laddr = self.getsockname()
|
laddr = self.getsockname()
|
||||||
if laddr:
|
if laddr:
|
||||||
s += ", laddr=%s" % str(laddr)
|
s += ", laddr=%s" % str(laddr)
|
||||||
except error:
|
except (error, AttributeError):
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
raddr = self.getpeername()
|
raddr = self.getpeername()
|
||||||
if raddr:
|
if raddr:
|
||||||
s += ", raddr=%s" % str(raddr)
|
s += ", raddr=%s" % str(raddr)
|
||||||
except error:
|
except (error, AttributeError):
|
||||||
pass
|
pass
|
||||||
s += '>'
|
s += '>'
|
||||||
return s
|
return s
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
Work around missing socket functions in :class:`~socket.socket`'s
|
||||||
|
``__repr__``.
|
||||||
|
|
@ -230,6 +230,7 @@ def main():
|
||||||
|
|
||||||
extmods = detect_extension_modules(args)
|
extmods = detect_extension_modules(args)
|
||||||
omit_files = list(OMIT_FILES)
|
omit_files = list(OMIT_FILES)
|
||||||
|
if sysconfig.get_platform().startswith("emscripten"):
|
||||||
omit_files.extend(OMIT_NETWORKING_FILES)
|
omit_files.extend(OMIT_NETWORKING_FILES)
|
||||||
for modname, modfiles in OMIT_MODULE_FILES.items():
|
for modname, modfiles in OMIT_MODULE_FILES.items():
|
||||||
if not extmods.get(modname):
|
if not extmods.get(modname):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue