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
{{ message }}
Repository navigation
Unnecessary specialization failures of LOAD_ATTR and STORE_ATTR when attributes are shadowed by the object's class. #123040
This applies to both instances and classes.
If an object and it's class both have attributes with the same name, this prevents specialization of access to the object's attribute.
However, in this case specialization should only be prevented if the class's attribute is a data descriptor.
Example 1, instance:
classC:
x=1def__init__(self):
self.x=2C().x
C().x above is 2. It doesn't matter that C.x exists, provided it isn't a data descriptor.
This failure shows up as "shadowed" in the stats
changed the title [-]Unnecessary specialization failures of `LOAD_ATTR` and `STORE_ATTR` when attributes are shadowed by the object' class.[/-][+]Unnecessary specialization failures of `LOAD_ATTR` and `STORE_ATTR` when attributes are shadowed by the object's class.[/+]on Aug 15, 2024
Activity
markshannon commentedon Aug 15, 2024
For
STORE_ATTR, the failures show up in various ways, depending on the nature of the class's attribute.[-]Unnecessary specialization failures of `LOAD_ATTR` and `STORE_ATTR` when attributes are shadowed by the object' class.[/-][+]Unnecessary specialization failures of `LOAD_ATTR` and `STORE_ATTR` when attributes are shadowed by the object's class.[/+]picnixz commentedon Aug 16, 2024
Should this one be categorized as a bug or a feature (AFAICT, it's not really a bug per se, it's just an inefficient path being taken)?
markshannon commentedon Aug 16, 2024
I'll just tag it "performance"
GH-123040: Specialize shadowed `LOAD_ATTR`. (GH-123219)