from typing import Any, AnyStr
def foo(arg1: AnyStr, arg2: AnyStr) -> None: ...
bar: Any = ""
foo(1, "") # Error correctly reported
foo(b"", bar) # No error (correct)
foo(1, bar) # No error (false negative)
In the presence of Any, I would expect mypy to allow any of the values of the constraint (in this case, str or bytes), but not any arbitrary type.
Playground link: https://mypy-play.net/?mypy=latest&python=3.8&flags=strict&gist=6970b49fa90d7767b0ef26c9f977e182