[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-25 Thread Ammar Askar
Ammar Askar added the comment: There's some context on the github PR but essentially it boiled down to: - It would make it inconsistent with line offsets which are 1-indexed. - Breaking change to a public C API (PyErr_SyntaxLocationObject) - IDLE and other tools that catch syntax errors rely o

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-24 Thread Benjamin Peterson
Benjamin Peterson added the comment: Wait, why did you make offsets 1-indexed? My suggestion was to make everything zero indexed... -- ___ Python tracker ___

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-24 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset 025eb98dc0c1dc27404df6c544fc2944e0fa9f3a by Guido van Rossum (Ammar Askar) in branch 'master': bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338) https://github.com/python/cpython/commit/025eb98dc0c1dc27404df6c544fc294

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-24 Thread Guido van Rossum
Guido van Rossum added the comment: Hm, should this be backported? I think it's safest not to. -- ___ Python tracker ___ ___ Python

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-24 Thread Guido van Rossum
Guido van Rossum added the comment: Fixed by gh-9338. Thanks Ammar! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-17 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-17 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- nosy: +pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-15 Thread Ammar Askar
Ammar Askar added the comment: Added a PR that is an implementation of Benjamin's suggestion. The column offset returned has been made 0-indexed and errors now point to the start of the parsed token. This makes errors like `def class` show up as def class ^ instead of def class

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-15 Thread Ammar Askar
Change by Ammar Askar : -- keywords: +patch pull_requests: +8761 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Eric V. Smith
Eric V. Smith added the comment: I think Benjamin's diagnosis is correct. In which case, my f-string error reporting changes (see #34364) won't intersect with a fix to this issue. -- ___ Python tracker

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Benjamin Peterson
Benjamin Peterson added the comment: I think ast.c is in the right here and there are two complementary bugs in caret printing and the parser. print_error_text does this: while (--offset > 0) PyFile_WriteString(" ", f); which is off-by-one if offset is zero-indexed (which it sho

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Eric V. Smith
Eric V. Smith added the comment: I'm doing some fairly major surgery on line and column numbers for fixing f-string errors. I'll see if I can include this case, too. -- nosy: +eric.smith ___ Python tracker

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: +emilyemorehouse ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-14 Thread Guido van Rossum
New submission from Guido van Rossum : Input file with a subtle error: a number where an assignment target is required: for 1 in []: pass Run it, it gives a SyntaxError. Note how the caret pointing to the incorrect token is position one to the left of where you'd expect it: File "s.py", l