Bug report
Bug description:
Currently, socket.shutdown is disabled in Emscripten build.
| # unsupported syscall, https://github.com/emscripten-core/emscripten/issues/13393 | |
| ac_cv_func_shutdown=no |
>>> import socket
>>> s = socket.socket()
>>> s.shutdown
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'socket' object has no attribute 'shutdown'
This is because the Emscripten does not have a proper socket support by default, therefore only have a stub implementation of shutdown syscall. So users who try to use socket.shutdown would see an error "Function not implemented" anyways.
However, I would like to propose enabling socket.shutdown for following reasons:
- We can overwrite Emscripten's socket syscall implementation to support shutdown in some environments. We are already doing that for some syscalls in Emscripten.
- I have proposed to enable socket operations in Emscripten for Node.js environments (Alternative SOCKFS in Node.js environment + synchronous socket calls using JSPI emscripten-core/emscripten#26041), and implementation is in progress in Enable socket.shutdown function pyodide/pyodide#6174
- Even without 1 and 2, I think it is less surprising to show "Function not implemented" error than "AttributeError: 'socket' object has no attribute 'shutdown'"
CPython versions tested on:
3.15
Operating systems tested on:
Other