typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Add new or missing socket constants on linux

Open hauntsaninja opened this issue 3 years ago • 2 comments

We currently silence many errors from socket constants in stubtest, because the availability of some constants cannot be expressed in the type system (and probably also because historically we weren't always the best at specifying all platform differences exactly). However, this means we don't notice new additions.

On macOS, with python3.10:

λ python3.10 -m mypy.stubtest --custom-typeshed-dir ~/dev/typeshed socket --concise | grep 'is not present in stub'
socket.CAPI is not present in stub
socket.IP_RECVTOS is not present in stub
socket.PF_SYSTEM is not present in stub
socket.SYSPROTO_CONTROL is not present in stub
socket.TCP_KEEPALIVE is not present in stub
socket.TCP_NOTSENT_LOWAT is not present in stub
[...]

I can add PRs for these / check this for Linux. Filing this issue mainly as a reminder for myself to do so. Would be good if someone wants to take another look at Windows.

hauntsaninja avatar Jun 19 '22 07:06 hauntsaninja

I'm in favour of adding these, and of getting some more coverage from stubtest. I can take a look on Windows to see what needs adding.

Missing socket constants have also been requested a few times by users:

  • #7077
  • #5696

AlexWaygood avatar Jun 19 '22 07:06 AlexWaygood

Stubtest is enabled for all the socket constants on Windows and macOS these days, but we still have two very broad allowlist entries on linux:

https://github.com/python/typeshed/blob/18cd196109938b690a97dc1dadf1c92b391b9639/tests/stubtest_allowlists/linux.txt#L1 https://github.com/python/typeshed/blob/18cd196109938b690a97dc1dadf1c92b391b9639/tests/stubtest_allowlists/linux.txt#L6

AlexWaygood avatar Nov 01 '23 18:11 AlexWaygood