8000 Duplicate module names causes Module has no attribute · Issue #8220 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}
Duplicate module names causes Module has no attribute #8220
Closed as not planned
Closed as not planned
@plannigan

Description

@plannigan

This is a bug report. There was a regression recently that caused mypy to start raising error where it did not in the past.

Example:
Save the following code at pathlib.py.

import pathlib

p = pathlib.Path(".")
print(p)

With the latest mypy, this fails.

$ mypy --version
mypy 0.761
$ mypy pathlib.py 
pathlib.py:3: error: Module has no attribute "Path"
Found 1 error in 1 file (checked 1 source file)

However, it used to work:

$ mypy --version
mypy 0.720
$ mypy pathlib.py 
$ 

Note: This code won't run, but I was having trouble making a simple example to reproduce the issue I was seeing. The actually case where this happened does work and was a sub-module within a project that was named the same as a 3rd part module it was wrapping.

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

      0