mypy 931 returns an error (Module has no attribute "NETLINK_ROUTE") for socket.NETLINK_ROUTE on Linux. The attribute exists as the code runs fine. Mypy 310 did not expose the problem
mypy should not return an error: Success: no issues found in 1 source file
Actual Behavior
route.py:5: error: Module has no attribute "NETLINK_ROUTE"
Found 1 error in 1 file (checked 1 source file)
Your Environment
Mypy version used: 910 and 931
Mypy command-line flags: None, but --platform=linux does not work either
Mypy configuration options from mypy.ini (and other config files): No mypy.ini file used
Python version used: 3.7, but 3.9 is affected as well
Operating system and version: Linux, Gentoo. Both Python versions were tested in virtual environments with mypy installed via pip (pip install mypy==0.910, e.g.).
Activity
JelleZijlstra commented on Jan 29, 2022
This is a typeshed issue: we need to re-export NETLINK_ROUTE from _socket.pyi in https://github.com/python/typeshed/blob/master/stdlib/socket.pyi.
kkirsche commented on Aug 18, 2022
Fix submitted in #8555