Skip to content

mypy_extensions: fix TypeVar usage #7937

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

Merged
merged 2 commits into from
May 24, 2022
Merged

Conversation

AlexWaygood
Copy link
Member

@overload
def Arg(type: _T, name: str | None = ...) -> _T: ...
@overload
def Arg(name: str | None = ...) -> Any: ...
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be keyword-only?

Also we should make sure that mypy still works with this change, it may special-case the definitions here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also we should make sure that mypy still works with this change, it may special-case the definitions here.

I was hoping primer would answer that question for me :)

Copy link
Member

Choose a reason for hiding this comment

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

Not sure anyone in primer uses these things though.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to try running the mypy test suite using MYPYPATH to point at the stubs with this revision.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think mypy won't like trying to use MYPYPATH for mypy_extensions (or maybe might ignore it). You're probably better off replacing mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi. But also I'm happy to yolo this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Tests all passed on my machine using MYPYPATH, I'm now trying @hauntsaninja's way as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Tests also all pass on my machine with the manual edit of mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi.

I'm also happy for this to be reverted if mypy's CI starts breaking unexpectedly!

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for double-checking!

Copy link
Member Author

Choose a reason for hiding this comment

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

No problem!

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood requested a review from JelleZijlstra May 24, 2022 18:25
@JelleZijlstra JelleZijlstra merged commit 54e11a1 into master May 24, 2022
@JelleZijlstra JelleZijlstra deleted the AlexWaygood-patch-1 branch May 24, 2022 18:26
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.

3 participants