| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I had to modify mypy/test/testdeps.py::GetDependenciesSuite::testDataclassDeps because of a side effect of the code modification. Dependency computation is indeed impacted, but I think this is not a real issue. |
Sorry, something went wrong.
|
Should be closed because a more general fix is done #10548 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
This PR is related to #708 and #5485, but fix them for dataclasses only. (Is there really an issue for regular classes?)
mypy currently handle dataclass callable fields as instance methods, as they are annotated at class level the same way a method would be. As a consequence, field node attribute is_initialized_in_class is True.
Here is an illustration of the current mypy behavior, comparing "regular" instance field annotation and dataclass one:
By setting field node is_initialized_in_class to False, the field is then treated the same way it would be when declared with annotated assignment in __init__ method.
A first PR #10292 by @aecay concerning this issue was merged one month ago, but its implementation was more complex and did not fix the bug for frozen dataclasses, so I've reverted it. I hope there is no problem with that.
Test Plan
Add unit tests: