Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathLike: change to Protocol #4447

Merged
merged 1 commit into from Aug 16, 2020
Merged

PathLike: change to Protocol #4447

merged 1 commit into from Aug 16, 2020

Conversation

hauntsaninja
Copy link
Collaborator

No description provided.

@hauntsaninja
Copy link
Collaborator Author

Hmm, discovered python/mypy#5775

@hauntsaninja
Copy link
Collaborator Author

Also, the stubtest windows tests aren't doing anything (and I think this has been the case for a while, probably since they were moved to Github Actions)

class _PathLike(Generic[AnyStr]):
def __fspath__(self) -> AnyStr: ...
_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True)
class _PathLike(Protocol[_AnyStr_co]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put this in _typeshed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to... even if it can be made to work, it'll involve a mypy-typeshed dance (and maybe changes to other type checkers) for little benefit.
Plus _typeshed is for making types internally reusable, and PathLike is already internally (and externally) reusable from os

@JelleZijlstra JelleZijlstra merged commit b438ccc into python:master Aug 16, 2020
@hauntsaninja hauntsaninja deleted the pat branch August 16, 2020 18:57
hauntsaninja pushed a commit to hauntsaninja/typeshed that referenced this pull request Sep 26, 2020
I made PathLike a protocol in python#4447, but it should also be
runtime_checkable.

Caught by mypy_primer:
src/werkzeug/utils.py:646: error: Only @runtime_checkable protocols can be used with instance and class checks
JelleZijlstra pushed a commit that referenced this pull request Sep 27, 2020
I made PathLike a protocol in #4447, but it should also be
runtime_checkable.

Caught by mypy_primer:
src/werkzeug/utils.py:646: error: Only @runtime_checkable protocols can be used with instance and class checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants