Yury Selivanov <[email protected]> added the comment:
On GH (https://github.com/python/cpython/pull/4877), Antoine wrote:
> I agree with Victor:
> it can't go into 3.6
> making the change in 3.7 is contentious
> Can there be an other way to solve the issue? Can we for example keep
> socket.type as it is and add a utility function or a property reporting the
> "masked" type?
I agree. Here's what I propose:
1. We don't touch `socket.type`. We don't know what kind of code exists out
there and in what ways it will break. The ship has sailed to fix it.
2. We add `socket.SOCK_TYPE_MASK` (on Linux).
3. We fix `socket.__repr__` to correctly render type. Currently:
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM |
socket.SOCK_NONBLOCK)
>>> s
<socket.socket fd=3, family=AddressFamily.AF_INET, type=2049, proto=0,
laddr=('0.0.0.0', 0)>
What I want to see:
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SOCK_STREAM |
SOCK_NONBLOCK, proto=0, laddr=('0.0.0.0', 0)>
4. We add `socket.true_type` which will apply `SOCK_TYPE_MASK` and return a
socket type that's safe to compare to `socket.SOCK_*` constants.
Thoughts?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue32331>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com