[issue25677] Syntax error caret confused by indentation

2017-03-31 Thread Donald Stufft
Changes by Donald Stufft : -- pull_requests: +1080 ___ Python tracker ___ ___

[issue25677] Syntax error caret confused by indentation

2016-12-19 Thread Martin Panter
Changes by Martin Panter : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2016-12-18 Thread Roundup Robot
Roundup Robot added the comment: New changeset 35b50c26f780 by Martin Panter in branch '3.5': Issue #25677: Correct syntax error caret for indented blocks. https://hg.python.org/cpython/rev/35b50c26f780 New changeset d4effdd699de by Martin Panter in branch '3.6': Issue #25677: Merge SyntaxError

[issue25677] Syntax error caret confused by indentation

2016-12-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. -- assignee: serhiy.storchaka -> martin.panter ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2016-12-10 Thread Martin Panter
Martin Panter added the comment: Patch v6 strips the form feed, and adds an extra test. -- Added file: http://bugs.python.org/file45844/cpython25677.v6.patch ___ Python tracker

[issue25677] Syntax error caret confused by indentation

2016-12-10 Thread Martin Panter
Martin Panter added the comment: (Long story short: need to strip form feeds in print_error_text(), but I agree that this otherwise does fix a bug.) There is one minor regression that this patch causes IMO. Given the following file, where represents a form feed character ('\014') if True:

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This may be just bad example that it looks contradictorily to you. Is the example "None = 0" looks good to you? Without patch the caret is located at the middle of None (depending on the size of the indentation of this line). With patch applied it is

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread Berker Peksag
Berker Peksag added the comment: With patch applied: File "x.py", line 2 1 + 1 = 2 ^ SyntaxError: can't assign to operator Without patch: File "x.py", line 2 1 + 1 = 2 ^ SyntaxError: can't assign to operator The caret is located at the wrong place in both examples

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: -haypo ___ Python tracker ___ ___

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The patch fixes one bug, and I'm going to push it. There is other bug here. If add "1;" before the original example (so the line becomes "1;1 + 1 = 2"), the caret will be under ";". In some SyntaxErrors the caret points one position left before the start of

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread Michael Layzell
Michael Layzell added the comment: This patch fixes a problem, which is that the caret was not placed where the source location information for the node is, but instead in a random position based on the indentation level. The problem that the caret is not placed under the `=` sign, but

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread Berker Peksag
Berker Peksag added the comment: FWIW, I don't think the patch fixes the actual problem. With the patch applied, the caret still placed at the wrong place. I'd prefer avoid pushing a patch that fixes a bug by introducing another bug. -- ___ Python

[issue25677] Syntax error caret confused by indentation

2016-11-07 Thread Michael Layzell
Michael Layzell added the comment: Is there something I should be doing to push this patch forward? I am not familiar with the contribution process for cpython unfortunately. -- ___ Python tracker

[issue25677] Syntax error caret confused by indentation

2016-11-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: LGTM. -- stage: patch review -> commit review versions: +Python 3.7 ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2016-11-01 Thread Chi Hsuan Yen
Changes by Chi Hsuan Yen : -- nosy: +Chi Hsuan Yen ___ Python tracker ___ ___

[issue25677] Syntax error caret confused by indentation

2016-01-09 Thread R. David Murray
Changes by R. David Murray : -- nosy: -r.david.murray ___ Python tracker ___ ___

[issue25677] Syntax error caret confused by indentation

2016-01-09 Thread Martin Panter
Martin Panter added the comment: +script = textwrap.dedent("1 + 1 = 2\n") You don’t need that first textwrap.dedent() call. It is only useful if the string has extra indentation at the start, as in the second multiline one. -- ___ Python tracker

[issue25677] Syntax error caret confused by indentation

2016-01-09 Thread Michael Layzell
Michael Layzell added the comment: Oops. Should be fixed now. -- Added file: http://bugs.python.org/file41559/cpython25677.patch ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2016-01-08 Thread Michael Layzell
Michael Layzell added the comment: Sorry for missing the review comments earlier, I didn't notice them (I've not used this bug tracker before - sorry). I've attached an updated patch which should not have the variable problem, and also takes some of the other review comments into account.

[issue25677] Syntax error caret confused by indentation

2015-12-10 Thread Berker Peksag
Berker Peksag added the comment: With the latest patch applied, the output is File "z.py", line 2 1 + 2 = 3 ^ SyntaxError: can't assign to operator I think the caret is still in wrong place. I would expect the following output: File "z.py", line 2 1 + 2 = 3 ^

[issue25677] Syntax error caret confused by indentation

2015-11-26 Thread Martin Panter
Martin Panter added the comment: Michael, see the review comments if you already haven’t. There is an unused variable “p” in the last two patches. -- ___ Python tracker

[issue25677] Syntax error caret confused by indentation

2015-11-26 Thread Martin Panter
Changes by Martin Panter : -- stage: test needed -> patch review ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2015-11-26 Thread Michael Layzell
Michael Layzell added the comment: Martin's solution seemed like the least work, so that's what I ended up using. I also switched over to assertRegex, and I agree that it produces better error messages. I added a comment to explain the use of the ugly multiline regex, and removed some of its

[issue25677] Syntax error caret confused by indentation

2015-11-25 Thread R. David Murray
R. David Murray added the comment: Two options on portability, I think: either use splitlines() on the decoded result, or add a 'universal_newlines' keyword argument to assert_python_failure and friends that would get passed to Popen. I'd favor the latter, as other users of script_helpers

[issue25677] Syntax error caret confused by indentation

2015-11-25 Thread Martin Panter
Martin Panter added the comment: Another way to get universal newlines I have used in other cases is to use TextIOWrapper. It might be easier if you really need that multi-line RE search: text = TextIOWrapper(BytesIO(stderr), "ascii").read() -- nosy: +martin.panter

[issue25677] Syntax error caret confused by indentation

2015-11-25 Thread Michael Layzell
Michael Layzell added the comment: Sorry for the delay, I finally got around to adding a test. I'm mildly concerned about the portability of the check, but it seems to work locally. If people have suggestions about how to make the check more portable, let me know! -- Added file:

[issue25677] Syntax error caret confused by indentation

2015-11-20 Thread R. David Murray
R. David Murray added the comment: It appears as though the line is always printed without the leading whitespace, but the caret takes the whitespace into account (try indenting the line even further). So the problem is that the caret and the printing of the source line in the error message

[issue25677] Syntax error caret confused by indentation

2015-11-20 Thread R. David Murray
R. David Murray added the comment: By the way, python3.4 also shows the behavior. Python2 does not, because python2 does not print the caret. The bug presumably crept in when the caret was added. I'm marking this as easy...presumably the hardest part of fixing it is figuring out exactly

[issue25677] Syntax error caret confused by indentation

2015-11-20 Thread R. David Murray
Changes by R. David Murray : -- stage: needs patch -> patch review ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2015-11-20 Thread Michael Layzell
Michael Layzell added the comment: This should fix the problem. It appears as though the indentation was being stripped from the program text differently depending on how the error was produced. In the case of a syntax error from the parser, the indentation was maintained until it was printed

[issue25677] Syntax error caret confused by indentation

2015-11-20 Thread R. David Murray
Changes by R. David Murray : -- nosy: +haypo, serhiy.storchaka ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2015-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Would be nice to have a test. -- stage: patch review -> test needed ___ Python tracker ___

[issue25677] Syntax error caret confused by indentation

2015-11-19 Thread Michael Layzell
New submission from Michael Layzell: It appears that syntax errors generated by checking the AST will get confused by indentation and place the caret incorrectly. With no indentation: === 1 + 1 = 2 === File "/Users/mlayzell/test.py", line 1 1 + 1 = 2 ^ SyntaxError: can't assign to