Skip to content

Cache re-used incorrectly #16652

Open
Open
@bersbersbers

Description

@bersbersbers

Bug Report

Same command gives different results depending on the cache.

To Reproduce

class Super:
    def draw(self):
        ...

class Class(Super):
    ...

Class().draw()

(Code is from #16651)

Expected Behavior

Same behavior of mypy --disallow-untyped-calls --untyped-calls-exclude=bug.Super bug.py regardless of the cache.

Actual Behavior

(.venv) C:\Build>rmdir .mypy_cache /s /q 

(.venv) C:\Build>mypy --disallow-untyped-calls --untyped-calls-exclude=bug.Super bug.py                   
bug.py:8: error: Call to untyped function "draw" in typed context  [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)

(.venv) C:\Build>mypy --disallow-untyped-calls --untyped-calls-exclude=bug bug.py        
Success: no issues found in 1 source file

(.venv) C:\Build>mypy --disallow-untyped-calls --untyped-calls-exclude=bug.Super bug.py 
Success: no issues found in 1 source file

(.venv) C:\Build>rmdir .mypy_cache /s /q   

(.venv) C:\Build>mypy --disallow-untyped-calls --untyped-calls-exclude=bug.Super bug.py  
bug.py:8: error: Call to untyped function "draw" in typed context  [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 1.7.1.
  • Mypy command-line flags: see above
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions