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
Eliminate redundant refcounting in the JIT for LOAD_ATTR_MODULE #143995
As a follow-up to #134584, we can eliminate redundant ref-counting for LOAD_ATTR_MODULE.
Note that if a module is imported globally (as is most commonly done, at the top of a file), attribute access via LOAD_ATTR_MODULE may be optimized into a constant load. Therefore, this optimization only applies when a module is imported locally, for example, within a function.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Activity
Fidget-Spinner commentedon Jan 18, 2026
I don't think we should optimize for this. This case is very rare and we introduce more complexity to the interpreter.
If you want, perhaps optimize _BINARY_OP or _BINARY_OP_EXTEND instead?
aisk commentedon Jan 18, 2026
Hi @Fidget-Spinner, thanks for the reply. I’ll give these a try.
Fidget-Spinner commentedon Jan 24, 2026
I've changed my mind. I think this is worthwhile when we fail to promote globals. Let's do this!
gh-143995: Eliminate redundant refcounting in the JIT from LOAD_ATTR_…
pythongh-143995: Eliminate redundant refcounting in the JIT from LOAD…