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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26703>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to