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
compiler: Unnecessary None in co_consts #89219
Comments
Python 3.10 compiler adds None to co_consts even when None is not used at all.
|
I wonder what the 3.10 compiler does different to cause this -- in 3.9 that extra None is not in co_consts. (Note: Mark is on vacation for 2 weeks.) |
I think LOAD_CONST None + RETURN_VALUE is added here. And it removed by optimize_cfg(). Lines 7795 to 7797 in 793f55b
I don't know how easy to remove this unnecessary None. |
I found anther example for unused constants. The Lines 663 to 675 in 863154c
Python 3.9.5: |
@pablo This issue seems an optimization rather than bugfix. #72296 removes not all unused constants, but only trailing unused constants. I want to backport it to 3.10 or 3.10.1 after Mark's review. |
Ok, please, add me as a reviewer to the backport once is ready. |
Let's wait for 3.10.1 to backport this because I prefer to keep pyc files stable for the release candidate. Turns out that people are already preparing wheels to 3.10 and although this may be fine, I don't want to risk incompatibilities for the release. |
Are you sure? I know we're really close to the release, but I'd much rather |
I honestly want to backport it because I think it should not have any negative impact, but on the other hand I don't feel very confident as the release candidate phase is supposed to be as close as possible as the final release and this is not fixing a critical bug. The devguide says about the RC:
I am just trying to be cautious but on the other hand we still have anltbet release candidate for people to try it out before the final release so if you all think is better to have this on the RC and this is not going to be an issue for existing universal wheels and the like, then I suppose we can merge it before Rc2 |
Since we're not changing the magic number, wheels created for rc1 will still work with the final 3.10 (and vice versa!) -- creating a wheel or PYC file just will produce a different sequence of bytes, but there are other things that do that. Then again, since we're not changing the magic number, it's not the end of the world to put off the backport to 3.10.1. So I've convinced myself that it actually doesn't matter, and probably it's best to wait for 3.10.1 (changes to the compiler are always risky). |
It goes to 3.10.1 then. Fixed! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: