-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix a crash when a pylint must display unicode raising a UnicodeEncodeError #9732
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 a crash when a pylint must display unicode raising a UnicodeEncodeError #9732
Conversation
We should probably aim to keep the |
|
@@ -0,0 +1 @@ | |||
comparison-of-constants:3:7:3:37::"Comparison between constants: 'π == ' has a constant value":HIGH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparison-of-constants:3:7:3:37::"Comparison between constants: 'π == ' has a constant value":HIGH | |
comparison-of-constants:3:7:3:37::"Comparison between constants: '"\U00010000" == "\ud800\udc00"' has a constant value":HIGH |
Imo we should aim for this, but I have an intuition that the ast module internal might be involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I don't think we can. self.out
is utf-8
encoded so we always need to encode/escape to utf-8
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to be fixed in comparison-of-constant I think 6584761
6c12004
to
96592c9
Compare
This comment has been minimized.
This comment has been minimized.
96592c9
to
49bf1a7
Compare
This comment has been minimized.
This comment has been minimized.
49bf1a7
to
6584761
Compare
comparison-of-constants:3:6:3:12::"Comparison between constants: '2 == 2' has a constant value":HIGH | ||
comparison-of-constants:6:6:6:11::"Comparison between constants: '2 > 2' has a constant value":HIGH | ||
comparison-of-constants:16:3:16:15::"Comparison between constants: 'True == True' has a constant value":HIGH | ||
comparison-of-constants:3:6:3:12::"Comparison between constants: ""2 == 2"" has a constant value":HIGH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears as double ""
but it's due to the "csv" encoding (the string start with "
) and it's actually fine.
"""This does not crash in the functional tests, but it did when called directly.""" | ||
|
||
assert "\U00010000" == "\ud800\udc00" # [comparison-of-constants] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't manage to reproduce the crash automatically. Might be due to some unicode's magic already present in the functional test.
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit 6584761 |
Type of Changes
Description
Fixes for #8736,
this is probably not the right fix, but it's a fix. Hoping for a surrogates/unicode expert to chime in with the right approach π !after becoming a surrogate expert myself. This prevent the crash in the general case (for all checkers even badly coded plugin) and make the message output for comparison of constant closer to the content of the code by using the AST instead of recalculating. We can backport half of this. Review is better commit by commit as there is two parts.