[issue32331] Add socket.truetype property

Yury Selivanov report at bugs.python.org
Fri Dec 15 22:41:19 EST 2017


Yury Selivanov <yselivanov at gmail.com> added the comment:

I've been thinking a lot about this problem, and I'm really tempted to fix sock.type property:

1. The problem first appeared in Python 3.2.

2. Python 2.7 doesn't have this problem at all, and doesn't even export socket.SOCK_NONBLOCK.  If we fix this in 3.7 it *will* actually help some poor souls with porting their network applications.

3. People use Python when they want a high-level portable language.  This annoying Linux quirk makes it super hard to write correct socket code.

4. I can't actually come up with any decent Linux-only example of using this quirk of socket.type.  Why would one check if sock.type has SOCK_NONBLOCK?  And even if they check it, one call to sock.settimeout() will make sock.type information outdated and simply wrong.

Let's just fix sock.type?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32331>
_______________________________________


More information about the Python-bugs-list mailing list