bpo-44337: Improve LOAD_ATTR specialization by markshannon · Pull Request #26759 · python/cpython
We were being overly conservative by not specializing for instance attributes when the class also has an attribute.
It is OK to perform that specialization if the class attribute is not an overriding descriptor (and has an immutable class, so it will remain so).
This requires more detailed analysis of the class attribute, so this is factored out in a new function, which we can also use when we specialize STORE_ATTR.
This PR also specializes obj.__class__ using LOAD_ATTR_SLOT.