Skip to content

Conversation

@JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Apr 4, 2023

Infer __init__ argument types from the signatures of descriptor __set__ methods, if present. We can't (easily) perform full type inference in a plugin, so we cheat and use a simplified implementation that should still cover most use cases. Here we assume that __set__ is not decorated or overloaded, in particular.

Fixes #14868.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

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

@JukkaL JukkaL merged commit 16bd311 into master Apr 5, 2023
@JukkaL JukkaL deleted the dataclass-transform-descriptors branch April 5, 2023 10:04
JukkaL added a commit that referenced this pull request Apr 5, 2023
Infer `__init__` argument types from the signatures of descriptor
`__set__` methods, if present. We can't (easily) perform full type
inference in a plugin, so we cheat and use a simplified implementation
that should still cover most use cases. Here we assume that `__set__` is
not decorated or overloaded, in particular.

Fixes #14868.
@JukkaL JukkaL mentioned this pull request Apr 5, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mypy has implemented pep-681 incorrectly and does not intepret descriptors correctly

4 participants