Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-45653: Freeze encodings package modules#29788
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
Conversation
kumaraditya303 commented Nov 26, 2021 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
f34e711 to 53ff4ebCompare53ff4eb to 16cab74CompareFFY00 commented Nov 26, 2021
I am alright with continuing it but if you want, I can take it. I will close this in favor of your PR 😊 |
FFY00 commented Nov 26, 2021
Oops, wrong PR 🤦 |
gvanrossum commented Nov 26, 2021
Do you have a clue about the test failures yet? (You know you can run tests locally right? Etc.) |
kumaraditya303 commented Nov 27, 2021
I am on Windows, and even in debug builds frozen modules are used which is kinda confusing because on Linux in debug mode frozen modules are not used. I know how to run tests but when I run test_embed on windows it skips it saying that _testembed.exe doesn't exists, even though it exists. I'll see if I can fix it. |
gvanrossum commented Nov 27, 2021
You are seeing the effect of https://bugs.python.org/issue45651. To force frozen modules on/off you can pass |
4c21f3d to f2ee158Comparegvanrossum commented Nov 29, 2021
@ericsnowcurrently Do you have any ideas to share on where to look for these failures? Apparently (deep)freezing part of a package is not fully supported yet. @kumaraditya303 I'll look into this later this week if we don't hear from Eric, but my hunch is that we need to add code (I don't know where yet) that ties the frozen package to the on-disk directory for the same package, so that PS. If you want your fix for test_embed incorporated, rebase on the new main branch. |
f2ee158 to 5f9e67fComparegvanrossum commented Nov 30, 2021
Looks like test_embed fails on all platforms (and a few others fail on Windows only). It looks like you have your test_embed fix in here. Could you revert that change and push that to this PR to see if that fixes the macOS and Ubuntu tests? (I tried it on Windows and it does fix it, somehow. So maybe it's just wrong?) |
kumaraditya303 commented Nov 30, 2021
I have rebased PR and included the test_embed fix by which I am atleast able to run test_embed, earlier it was skipped moreover that change only affects windows cpython/Lib/test/test_embed.py Lines 64 to 69 in 4b97d97
|
gvanrossum commented Nov 30, 2021
Nevermind, reverting that just skips test_embed on Windows. The culprit must be that some way of setting the default encoding causes Python to fail, presumably because it can't find the encoding in the encodings package. I'd focus on finding the culprit here (hopefully you can figure out how to run just the failing command, outside the test harness). |
gvanrossum commented Nov 30, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I can tell you that the test_embed failures seem to ultimately come from line 194-195 in Python/codecs.c::_PyCodec_Lookup, called from Objects/unicodeobject.c::init_stdio_encoding at line 15913 (!). (UPDATE: Via config_get_codec_name at line 15870.) |
ericsnowcurrently commented Nov 30, 2021
The most notable thing to me is that 4 of the 5 failing tests are printing nothing to stdout. This means that I suspect
It should be something like
|
gvanrossum commented Nov 30, 2021
This it does, even when I pass However the failing tests seem to be embedding Python (hence |
ericsnowcurrently commented Dec 1, 2021
Good point. That's an important observation. If we cannot extrapolate the stdlib dir during runtime init then frozen modules will not have So, if that is the problem then: One possible fallback for runtime-init-could-not-find-stdlib-dir is to manually walk One thing to watch out for when walking Another possible solution is to disable the frozen FWIW, the matter of runtime init not finding the stdlib dir (and hence |
5f9e67f to 6ee879bComparegvanrossum commented Dec 2, 2021
Kumar, pleased don’t force push. Use merge instead of rebase; and add new commits as you change the code. It makes review easier, and we will squash at the end when we merge upstream. |
kumaraditya303 commented Dec 2, 2021
Okay, will always merge onwards :) |
gvanrossum commented Dec 4, 2021
Hey, you don't have to merge every commit on main! Also, you need a news item. Follow the instructions in the relevant test failure. |
kumaraditya303 commented Dec 5, 2021
There was a conflict with getpath.c hence I needed to merge main. |
gvanrossum commented Jan 6, 2022
Honestly I think this should work. I will close and reopen the issue so as to re-trigger the CI. |
gvanrossum commented Jan 6, 2022
...aand, we're back! |
gvanrossum commented Jan 6, 2022
887145b to b806d9dCompareb806d9d to 3199a97Comparegvanrossum commented Feb 14, 2022
Hey @kumaraditya303, what are your plans for this PR? It seems it currently fails some tests and there's also the problem reported by @tiran in https://bugs.python.org/issue45653#msg408474. |
kumaraditya303 commented Feb 15, 2022
It is failing on the same embedding tests as earlier and I am busy currently so I'll investigate later on this as the tests are a bit tough to debug on this one. |
gvanrossum commented Feb 15, 2022
Okay, no worries! |
kumaraditya303 commented Jun 30, 2022
I wasn't able to fix this despite debugging it for months and the performance improvement is negligible on Linux. I close this PR. |
gvanrossum commented Jun 30, 2022
Sorry to hear it, but it sounds like it’s for the best. |
kumaraditya303 commented Jun 30, 2022
No worries, I don't usually leave things unfinished but the perf improvement from this if the current issue could be solved is not worth it so I decided to leave it. I may revisit this if I find something but I have some other more interesting thing TODO ;) |
Freezes encodings modules as suggested by @gvanrossum
https://bugs.python.org/issue45653