3 ms·
As far as I know, the only errors that you're supposed to "except: pass" from socket.shutdown are OSErrors. I think you want anything else (if it even throws an
by postpawl 5y ago
As far as I know, the only errors that you're supposed to "except: pass" from socket.shutdown are OSErrors. I think you want anything else (if it even throws anything else?) to be fatal.
This is the same way cpython handles it: https://github.com/python/cpython/blob/b56774bd93822e1598bb5d6c1d0b1fe8c45a750d/Lib/socketserver.py#L509-L514 https://github.com/python/cpython/blob/b56774bd93822e1598bb5...
The context manager idea sounds good, but I think that might require a lot of refactoring.