gh-145834: email.charset: remove viscii from CHARSETS — no Python codec exists#145835
Closed
stefanzetzsche wants to merge 4 commits intopython:mainfrom
Closed
gh-145834: email.charset: remove viscii from CHARSETS — no Python codec exists#145835stefanzetzsche wants to merge 4 commits intopython:mainfrom
viscii from CHARSETS — no Python codec exists#145835stefanzetzsche wants to merge 4 commits intopython:mainfrom
Conversation
email.charset registered viscii but Python has no viscii codec, causing LookupError on any encoding operation. Removed viscii from CHARSETS table. sim: https://taskei.amazon.dev/tasks/TODO
Member
|
Please, avoid opening PRs without the issue having been triaged. We welcome contributions, but we don't want PRs sitting there because they were generated in series (I assume that you are using an LLM to generate the description and I also think that it helped you for the writing the code; please read https://devguide.python.org/getting-started/generative-ai/ as well). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
email.charsetregistersvisciiin itsCHARSETStable with QP header and body encoding, but Python ships novisciicodec. Any encoding operation onCharset('viscii')raisesLookupError: unknown encoding: viscii.Reproducer
Fix
Remove the
visciientry fromCHARSETSinLib/email/charset.py. There is no Python codec for viscii and no obvious mapping to add viaCODEC_MAP.Tests
Two test cases added to
TestCharsetinLib/test/test_email/test_email.py:test_viscii_not_registered— verifiesvisciiis no longer inCHARSETS.test_all_charsets_have_codecs— verifies every charset registered inCHARSETSmaps to a resolvable Python codec, preventing this class of bug from recurring.