[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

April 7, 2016
6:44 a.m.
Antoine Pitrou added the comment: The general answer here is you should avoid mixing calls to different abstraction layers. Either use only the file descriptor or only the socket object. This is not limited to lifetime issues, other issues can occur. For example, setting a timeout on a socket puts the underlying file descriptor in non-blocking mode. So code using the file descriptor can fail with EAGAIN. If you really want to use *both* a file descriptor and a socket object, you can use os.dup() on the file descriptor, so that the OS resources are truly independent. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue26703> _______________________________________
3246
Age (days ago)
3246
Last active (days ago)
0 comments
1 participants
participants (1)
-
Antoine Pitrou