Skip to content

--disallow-untyped-calls allows calling values with Any type #5968

Open
@JukkaL

Description

@JukkaL

The calls to f and ff below aren't rejected when using --disallow-untyped-calls, even though I believe that they should be:

from typing import Any

from non_existent import f  # type: ignore  # Not in the build

def g(): pass

def h() -> None:
    g(asdf=1)  # Error: Call to untyped function "g" in typed context
    f(asdf=1)  # No error reported, but this is untyped
    ff: Any
    ff()  # No error reported, and again this in untyped

At the very least the first call should probably be caught. If non_existent gets added in the build with no type annotations, it would start generating errors. However, I'd expect that adding a module to the build should result in fewer Any-related errors, not more.

Marking this a high priority since I've been bit by this twice in production code.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions