You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
--
This PR aims to resolve (or help to resolve) #18442 and #19357 by encoding the
CPython semantics around the `__class__` cell in our semantic model. Namely,
> __class__ is an implicit closure reference created by the compiler if any methods in a class body refer to either __class__ or super.
from the Python [docs](https://docs.python.org/3/reference/datamodel.html#creating-the-class-object).
As noted in the code comment by @AlexWaygood, we don't fully model this
behavior, opting always to create the `__class__` cell binding in a new
`ScopeKind::ClassCell` around each method definition, without checking if any
method in the class body actually refers to `__class__` or `super`.
As such, this PR may only help with #18442 and not #19357.
Test Plan
--
Existing tests, plus (TODO) tests from #19783 and #19424, which tackled the
issues above on a per-rule basis.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
0 commit comments