Message308410
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? |
|
Date |
User |
Action |
Args |
2017-12-15 16:38:52 | yselivanov | set | recipients:
+ yselivanov, pitrou, vstinner, christian.heimes, asvetlov, methane |
2017-12-15 16:38:52 | yselivanov | set | messageid: <1513355932.76.0.213398074469.issue32331@psf.upfronthosting.co.za> |
2017-12-15 16:38:52 | yselivanov | link | issue32331 messages |
2017-12-15 16:38:52 | yselivanov | create | |
|