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

Make staticmethod/classmethod generic in their return type #6285

Merged
merged 2 commits into from
Nov 12, 2021

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Nov 12, 2021

This proposal is basically "make classmethod and staticmethod generic in such a way that we get more type specificity now, and it will also be easy to add ParamSpec once mypy supports it".

Slightly different to @srittau's approaches in #5703 and #5682

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pydantic (https://github.com/samuelcolvin/pydantic.git)
+ pydantic/class_validators.py:57: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:84: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:100: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:107: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:113: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:125: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:135: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/class_validators.py:328: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/main.py:869: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/main.py:882: error: Missing type parameters for generic type "classmethod"  [type-arg]
+ pydantic/main.py:894: error: Missing type parameters for generic type "classmethod"  [type-arg]

@srittau srittau merged commit 16a76a6 into python:master Nov 12, 2021
@AlexWaygood AlexWaygood deleted the classmethod-staticmethod-generic branch November 12, 2021 16:35
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.

2 participants