Cameron Trando added the comment:
What happened is that we have a hard time analyzing PathLike because in the
pathlib stub they use PathLike[str], so when we try to analyze Path which
inherits from PathLike[str], because PathLike is not generic, then we think
it's an instance of an object
New submission from Cameron Trando :
Currently os.PathLike[str] causes a runtime error; however, typeshed sees it as
valid and mypy does not throw any errors on it.
mypy treats it as os.PathLike[AnyStr]
I already filed a bug on typeshed, see
https://github.com/python/typeshed/issues/3202