| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Mark ordinary and plugin-generated __slots__ symbols as class variables so inheritance does not produce spurious instance/class variable override errors. Add regression coverage for ordinary classes, dataclasses, and attrs classes.
Keep __slots__ classified as a class variable for type checking, but do not attach it to native classes at runtime. Native classes use their own layout, and exposing inherited slots prevents compiled subclasses from being created. Add a compiled inheritance regression that reproduces the CI failure.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Sorry, something went wrong.
|
Could you make an issue first? Thanks. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Python defines __slots__ on the class, but mypy currently classifies generated slots as instance variables. This produces an inconsistent override error when a subclass declares an explicitly typed empty __slots__:
Before this change, the ignore is required to suppress:
The same inconsistency applies to ordinary __slots__ and attrs-generated slots.
This PR classifies ordinary and plugin-generated __slots__ symbols as class variables while preserving the existing special __slots__ type and layout handling. It adds inheritance regression coverage for ordinary classes, dataclasses, and attrs classes.
Test plan: