Handle UnicodeDecodeError in check.#12
Merged
audreyfeldroy merged 1 commit intobinaryornot:masterfrom Aug 16, 2015
DRMacIver:fix-key-error
Merged
Handle UnicodeDecodeError in check.#12audreyfeldroy merged 1 commit intobinaryornot:masterfrom DRMacIver:fix-key-error
audreyfeldroy merged 1 commit intobinaryornot:masterfrom
DRMacIver:fix-key-error
Conversation
This file causes chardet to give a high confidence for an encoding which python cannot decode the file as, which triggers a UnicodeDecodeError. This should just result in is_binary returning false but instead results in a KeyError. The reason for this is that the error is thrown before the local was assigned, and thus when it comes to formatting the string for logging the local is not present and so you get the KeyError.
audreyfeldroy
added a commit
that referenced
this pull request
Aug 16, 2015
Handle UnicodeDecodeError in check.
Collaborator
|
Thanks for catching this @DRMacIver. Hypothesis sounds amazing and you've piqued my curiosity with this...I'd love a PR with Hypothesis-based tests if you have time. I'm taking a look at the Hypothesis docs now. |
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.
This file causes chardet to give a high confidence for an
encoding which python cannot decode the file as, which triggers
a UnicodeDecodeError. This should just result in is_binary returning
false but instead results in a KeyError.
The reason for this is that the error is thrown before the local
was assigned, and thus when it comes to formatting the string for
logging the local is not present and so you get the KeyError.
Note: This example was actually found by Hypothesis. So far it's not found any others that are definitely bugs (though there are a few suspicious examples it found I can give you), but I can also submit a pull request that adds some Hypothesis based tests if you want it.