mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
[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:
parent
14adf4667e
commit
390123b412
3 changed files with 7 additions and 3 deletions
|
@ -254,17 +254,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__``.
|
|
@ -229,7 +229,8 @@ def main():
|
||||||
|
|
||||||
extmods = detect_extension_modules(args)
|
extmods = detect_extension_modules(args)
|
||||||
omit_files = list(OMIT_FILES)
|
omit_files = list(OMIT_FILES)
|
||||||
omit_files.extend(OMIT_NETWORKING_FILES)
|
if sysconfig.get_platform().startswith("emscripten"):
|
||||||
|
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):
|
||||||
omit_files.extend(modfiles)
|
omit_files.extend(modfiles)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue