Skip to content

Convert LOAD_ATTR_MODULE to a constant where the module is already a constant #115651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #115419
markshannon opened this issue Feb 19, 2024 · 1 comment
Closed
Tracked by #115419
Assignees

Comments

@markshannon
Copy link
Member

markshannon commented Feb 19, 2024

Expressions like mod.attr, where mod is a module, are in almost all cases effectively constants.

We should optimize them as such.
We already treat the mod as a constant, so it is a relatively simple step to treat mod.attr as a constant.

Linked PRs

@markshannon markshannon self-assigned this Feb 19, 2024
markshannon added a commit that referenced this issue Feb 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…he module is itself a constant. (GH-115711)
@gvanrossum
Copy link
Member

Can this be closed now?

woodruffw pushed a commit to woodruffw-forks/cpython that referenced this issue Mar 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…when the module is itself a constant. (pythonGH-115711)
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…when the module is itself a constant. (pythonGH-115711)
LukasWoodtli pushed a commit to LukasWoodtli/cpython that referenced this issue Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants