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
python program starting with unmatched quote spews spaces to stdout #54415
Comments
To reproduce: python -c "'" (Hint: don't do this on a slow terminal) |
This is caused by r85814. I've got a fix, as soon as I get it in a presentable state I'll post it. |
This patch fixes the issue, and makes print_error_text slightly more understandable (and efficient to boot, not that it matters). But I'm not convinced it's the correct solution. I think the real error might be the computation "offset" in the caller. I'm still looking at it. |
Now that I think about it some more, I think my patch (although it fixes this issue and passes all tests) doesn't do what the original code does in the presence of multiple newlines. I'm going to rework it some more. I'll have another patch shortly. |
I think Benjamin fixed this in r85904. I'm going to verify and add some tests. |
I'm unable to reproduce this. I checked out the commit 65614:18989ad44636 (corresponding to r85814, right?), built and ran python -c "'", but didn't get a space flood on my face. Just a normal SyntaxError. |
I remember that I could reproduce it at the time. The issue was indeed |
By checking out the parent of r85904 I now can reproduce this. |
Attached a test case. The patch is against the current default tip. |
Hmm. I don't know that it is really necessary to cater to the particular failure mode, I was more interested in seeing a unit test that checked the correct behavior: that a syntax error is raised (by capturing the output using the tools in script_helper). If we do keep the timeout, comments explaining why would be a good idea, because it is completely un-obvious why the test is doing what it is doing... |
I've attached an alternative test case. I'm not sure if there is a more robust way to test: Due the use of 'SyntaxtError' directly as string. I would prefer something like str(SyntaxtError) (or just the name of the exception Review is welcome |
I think that self.assertRegex(err.decode('ascii', 'ignore'), 'SyntaxError') would be fine. We are extremely unlikely to change the string representation of the name of SyntaxError or omit it from the error message, so I think this is a reliable test. If you really want to be paranoid, you could use SyntaxError.__name__ as the argument to assertRegex, but there are a number of other places in the test suite where we hardcode the exception names, so I don't think it is necessary. |
Just attaching the review patch |
On 06/24/2011 06:07 PM, R. David Murray wrote:
I understand that's the standard way to check if a given failure Thanks ! Francisco |
New changeset 2a4764376c51 by R David Murray in branch '3.2': New changeset 5ec95f46bac5 by R David Murray in branch 'default': |
Thanks, Petri and Francisco. Eric, I'm closing this since we now have a minimal test. If you still want to go back and add more tests based on a deeper understanding of what was broken, feel free to reopen the issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: