KEMBAR78
overload hides 'is not a function' error in stubtest · Issue #10254 · python/mypy · GitHub
Skip to content

overload hides 'is not a function' error in stubtest #10254

@hatal175

Description

@hatal175

Bug Report

I've noticed that overloading a function can hide a mismatch between the runtime type and the stub type. I noticed this as I was going over typeshed stubtest exceptions, specifically for itertools.accumulate.
Tests for python 3.6 and 3.7 failed because the stubs declared accumulate as a function while it was actually a class. However for 3.8 it is defined as two functions with overload and the tests passed successfully.

To Reproduce

(Write your steps here:)

  1. Run stubtest for typeshed in python 3.8.
  2. Test passes.
  3. Remove one of the overloads in itertools.pyi
  4. run again and see it fails.

Expected Behavior

I t should fail on a type mismatch like it does for no overloads.

Actual Behavior

passed.

Your Environment

Ran from latest python 3.8 and latest mypy from github.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions