[issue21327] socket.type value changes after using settimeout()

STINNER Victor report at bugs.python.org
Tue Apr 22 23:51:36 CEST 2014


STINNER Victor added the comment:

I would prefer to add something to get the type without SOCK_NONBLOCK nor
SOCK_CLOEXEC. So new feature can only be added to Python 3.5. For older
Python versions, you can to filter manually, which is difficult because you
have yo check if SOCK_NONBLOCK and/or SOCK_CLOEXEC are available. You have
the same issue in the C language.

Anyway, all sockets are now created with SOCK_CLOEXEC since Python 3.4
because of the PEP 446 (cloexec).

We can add a new .sock_type attribute. Or .type could be an object with
attributes like: type (int/enum), cloexec, nonblock, etc.

Or simply a short helper method can be added. Ex:
socket.get_socket_type(sock) or socket.get_socket_type(sock.type).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21327>
_______________________________________


More information about the Python-bugs-list mailing list