-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix all codec issues #145
Merged
Merged
Fix all codec issues #145
Conversation
This file contains 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
It complains about runTest() returning anything other than None.
Registering 'idna' does nothing, as the standard library version will always take precedence. Renamed codec.getregentry() to codec.search_function() to avoid confusion - getregentry is copied from the encodings.* standard library modules, but those functions in those modules are *not* codec search functions (hence why they don't have or check a 'name' argument).
Also add a test to ensure the codec we are using genuinely is our codec and not the standard library's version!
Convert the input to a string before processing it.
Thanks Jon! |
I'm not sure what is up with the |
kjd
added a commit
that referenced
this pull request
Jun 19, 2023
In PR #145, the tests are giving abberant results which appears to be a mypy issue, not a legitimate issue with the types.
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.
Closes #128, closes #134, closes #138, closes PR #144 (by incorporating it).
The attempt to use 'idna' as the codec name has been removed, as Python searches through the registered codecs in the order that they were registered, and the 'encodings' module (which provides the system 'idna') is imported as part of the interpreter start-up, so it will always win.
core.encode
/core.decode
have been changed so that instead of saying "if the input type is bytes, calls.decode
" they say "if the input type is not str, callstr(s)
". This is important, not least because when you callb'foo'.decode('idna2008')
, Python actually passes the codecdecode
function amemoryview
object!The codec tests file has been considerably expanded so that it will detect all the issues that were fixed, and so that all the codec entry points are tested.