-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-40585: Normalize errors messages in codeop when comparing them #20030
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
Conversation
Why not fix the new parser to produce an error message that doesn't end in a newline? This could affect other uses as well. |
With the new parser, the error message contains always the trailing newlines, causing the naive comparison of the repr of the error messages in codeop to fail.
👍 I was not sure if we were relying on those newlines elsewhere. I will try to do the normalization in |
Indeed, there are tests that fail if the newline is not there. For instance:
|
Ok, I think I have something that works. I have reverted my changes to |
But then you must not be doing the same thing as the old parser. I created a little test program:
Output with old parser always includes a newline:
But with new parser only when there's a newline in the source:
|
FWIW there are also differences with
IIRC the old parser adds a newline in Not sure how to handle this. Maybe always append the newline??? |
Ugh. The current version of the patch is always trimming all newlines. But seems that this is not what the old parser does. Seems that we need to maintain the last one when using |
(See my edited comment.) |
Apparently that makes some other tests in |
…hen comparing them
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.
If this passes in CI, go for it.
Seems that it was something wrong with my .pythonrc |
With the new parser, the error message contains always the trailing
newlines, causing the naive comparison of the repr of the error messages
in codeop to fail.
https://bugs.python.org/issue40585