Skip to content

Regression from 310 to 931: Module has no attribute "NETLINK_ROUTE" #7077

Closed

Description

@christgau

Bug Report

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

To Reproduce

  1. Suppose the following program route.py
import socket
import sys

print(sys.platform)
s = socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, socket.NETLINK_ROUTE)
print(s)
  1. Run mypy route.py

Expected Behavior

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

  1. JelleZijlstra commented on Jan 29, 2022

    @JelleZijlstra
    Member

    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.

  2. kkirsche commented on Aug 18, 2022

    @kkirsche
    Contributor

    Fix submitted in #8555

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions