Repository navigation
fix: add missing NETLINK re-exports of linux socket constants - #8555
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| CAN_RAW_RECV_OWN_MSGS as CAN_RAW_RECV_OWN_MSGS, | ||
| CAN_RTR_FLAG as CAN_RTR_FLAG, | ||
| CAN_SFF_MASK as CAN_SFF_MASK, | ||
| NETLINK_ARPD as NETLINK_ARPD, |
There was a problem hiding this comment.
Can you add NETLINK_CRYPTO?
For what it's worth these are the ones that exist on my Linux system:
In [30]: sorted(k for k in socket.__dict__ if k.startswith("NETLINK_"))
Out[30]:
['NETLINK_CRYPTO',
'NETLINK_DNRTMSG',
'NETLINK_FIREWALL',
'NETLINK_IP6_FW',
'NETLINK_NFLOG',
'NETLINK_ROUTE',
'NETLINK_USERSOCK',
'NETLINK_XFRM']
There was a problem hiding this comment.
https://github.com/python/typeshed/runs/7899804531?check_suite_focus=true
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/load_pytd.py", line 262, in resolve_external_types
mod_ast = mod_ast.Visit(visitors.LookupExternalTypes(
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/parse/node.py", line 99, in Visit
return _Visit(self, visitor, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/parse/node.py", line 117, in _Visit
return _VisitNode(node, visitor, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/parse/node.py", line 209, in _VisitNode
new_child = _VisitNode(child, visitor, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/parse/node.py", line 168, in _VisitNode
new_child = _VisitNode(child, visitor, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/parse/node.py", line 209, in _VisitNode
new_child = _VisitNode(child, visitor, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/parse/node.py", line 222, in _VisitNode
new_node = visitor.Visit(new_node, *args, **kwargs)
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/base_visitor.py", line 203, in Visit
return self.visit_functions[node.__class__.__name__](
File "/opt/hostedtoolcache/Python/3.10.6/x64/lib/python3.10/site-packages/pytype/pytd/visitors.py", line 473, in VisitNamedType
raise KeyError(f"No {name} in module {module_name}") from e
KeyError: 'No NETLINK_CRYPT in module _socket'
There was a problem hiding this comment.
Ohhhh I forgot the O.....
There was a problem hiding this comment.
What Linux OS? I believe these are imported from the C headers, so I expect this is going to be flavor-dependent in some cases, though I could be wrong about that
There was a problem hiding this comment.
Ubuntu 18.04, kernel 5.4.0. Yes, I think it depends on the kernel version and who knows what else. We should include all constants that can appear in realistic systems so people don't get false positives; we can't hope to replicate the exact conditions that determine what constants are available in stubs.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
fix: #7077
This re-exports the following linux-only (I'm trusting the stubs, haven't verified) constants:
https://github.com/python/typeshed/blob/master/stdlib/_socket.pyi#L522-L538