Author Dima.Tisnek
Recipients Dima.Tisnek, Ma Lin, Mariatta, ned.deily, njs, ronaldoussoren
Date 2020-04-07.08:41:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586248881.17.0.35696600075.issue40060@roundup.psfhosted.org>
In-reply-to
Content
Wow, very curious.

Yes, it's very much like `socket.TCP_KEEPCNT` in that respect, though, admittedly I don't have a very old Mac to test this right now. I think there were VMs for that maybe? 🤔



I wonder, what failure would be best for a naive code below, a NameError or OSError(errno=42)?

sock.setsockopt(socket.SOL_TCP, socket.TCP_NOTSENT_LOWAT, 42)

I guess the question is, at what level should the users catch exceptions...
After all, we don't delete this constant on Linux, and surely someone somewhere runs a very old kernel...



Oddly according to https://github.com/search?l=Python&q=%22socket.TCP_NOTSENT_LOWAT%22&type=Code none (in the OSS community) appears to be using this feature yet?

The search without `socket.` prefix yields a bunch of vendored mypy pyi's, but no actual code either.

And some even work around the constant being optional: https://github.com/python-trio/trio/blob/5b91edb2a860d024ab057e2be55fb34f311bf8ed/trio/socket.py#L170-L178



So, would this be a "not a regression" if none appears to use this constant yet?

Or do we take "don't break existing code" so seriously, that in this case too, we ought to assume that there's someone out there who has private code like below which we must not break?:

if code := getattr(socket, "TCP_NOTSENT_LOWAT", None):
    sock.setsockopt(socket.SOL_TCP, code, 42)



P.S.
If someone wants to take https://github.com/python/cpython/pull/19402 forward, by all means :)
Or I can try to hack up delete-at-runtime...
History
Date User Action Args
2020-04-07 08:41:21Dima.Tisneksetrecipients: + Dima.Tisnek, ronaldoussoren, ned.deily, njs, Ma Lin, Mariatta
2020-04-07 08:41:21Dima.Tisneksetmessageid: <1586248881.17.0.35696600075.issue40060@roundup.psfhosted.org>
2020-04-07 08:41:21Dima.Tisneklinkissue40060 messages
2020-04-07 08:41:20Dima.Tisnekcreate