Repository navigation
gh-158889: Fix recursive lookup of the iconv filesystem codec - #162843
MakStashkevich wants to merge 1 commit into
Conversation
|
Thank you for your interest in contributing to Python. This is a community-driven project, and we want it to be a welcoming place to learn and collaborate. Contributors are responsible for reviewing and understanding what they submit, checking its claims, and being able to explain changes in their own words. This helps reviewers focus on the contribution and leaves more time to support other contributors. This contribution appears to have been authored with AI assistance. Please explain your contribution in your own words and describe how you checked its correctness. Please read our guidelines for using AI tools. |
|
Thank you for your interest in contributing to Python. This is a community-driven project, and we want it to be a welcoming place to learn and collaborate. Contributors are responsible for reviewing and understanding what they submit, checking its claims, and being able to explain changes in their own words. This helps reviewers focus on the contribution and leaves more time to support other contributors. We believe this contribution does not meet our guidelines for using AI tools, so we're closing it. If you think we've misunderstood your contribution, please let us know. You're welcome to explain your approach or ask questions about the guidelines. Please read our guidelines for using AI tools. |
|
Sorry applied the wrong label, I wanted the AI explanation. |
|
Thanks for clarifying. After the codec caches are cleared, looking up the filesystem encoding tries to import a codec module. Resolving that module’s path needs the same encoding, so the lookup recurses. The fix remembers that there’s no built-in module for this encoding and lets the lookup proceed to On Fedora 44 with Could you reopen the PR for review? |
Fixes #158889.
Clearing the codec caches causes an iconv-backed filesystem encoding to go through the built-in codec search again. Importing a codec module requires encoding the module path with that same filesystem codec, which re-enters the search.
Remember the built-in module miss for the filesystem encoding once the iconv fallback supplies it. Add a regression test that clears both caches and checks that a non-ASCII path still encodes and decodes.
Testing
hy_AM.armscii8and UTF-8 mode disabled. The regression test fails withRecursionErrorbefore the fix and passes after it. The fulltest_codecsmodule passes with the fix.C.UTF-8.test_codecs,test_sys,test_locale, andtest_embedpass.