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
LOAD_ATTR cache does not fully replicate PyObject_GetAttr behavior #86432
Given that having attributes that are classes is quite uncommon, I think we can not optimize of the attribute itself is a class instead of checking for descriptors on every hit, hurting the performance gains
We could also store the tag of the type object if is a descriptor and compare against that on the cache hit to check that our assumptions are valid. The price here would be an extra pointer on the cache per opcode that may not even be used most of the time.
Activity
KevinModzelewski commentedon Nov 4, 2020
The problem is that the descriptor-ness of a type-level attribute is only checked at opcache-set time, not at opcache-hit time.
pablogsal commentedon Nov 4, 2020
Good catch, Kevin! Would you like to submit a PR for fixing this?
pablogsal commentedon Nov 4, 2020
Given that having attributes that are classes is quite uncommon, I think we can not optimize of the attribute itself is a class instead of checking for descriptors on every hit, hurting the performance gains
pablogsal commentedon Nov 4, 2020
Yury, any preference here?
pablogsal commentedon Nov 4, 2020
We could also store the tag of the type object if is a descriptor and compare against that on the cache hit to check that our assumptions are valid. The price here would be an extra pointer on the cache per opcode that may not even be used most of the time.
pablogsal commentedon Nov 4, 2020
s/the attribute itself is a class/the attribute itself is in the class/
pablogsal commentedon Nov 5, 2020
New changeset 80449f2 by Pablo Galindo in branch 'master':
bpo-42266: Handle monkey-patching descriptors in LOAD_ATTR cache (GH-23157)
80449f2