Unnecessary specialization failures of LOAD_ATTR
and STORE_ATTR
when attributes are shadowed by the object's class.
#123040
Labels
3.14
bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
performance
Performance or resource usage
Uh oh!
There was an error while loading. Please reload this page.
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:
C().x
above is2
. It doesn't matter thatC.x
exists, provided it isn't a data descriptor.This failure shows up as "shadowed" in the stats
Example 2, class:
C.x
is2
.Meta.x
doesn't change that, as it isn't a data descriptor.This failure shows up as "metaclass attribute" in the stats
Linked PRs
LOAD_ATTR
. #123219The text was updated successfully, but these errors were encountered: