[issue26571] turtle regression in 3.5
Change by William Navaraj : -- nosy: +williamnavaraj nosy_count: 6.0 -> 7.0 pull_requests: +28569 pull_request: https://github.com/python/cpython/pull/30355 ___ Python tracker <https://bugs.python.org/issue26571> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46260] Misleading SyntaxError on f-string
William Navaraj added the comment: @Eric Smith,Thanks for explaining the intuition behind this statement. I agree. Just to avoid ambiguity we could add "f-string: unmatched '%c' - no matching open parenthesis or missing '}'" The only possibility at nested_depth==0 line 665 is either of those because of the check in line 559 i.e. assert(**str == '{') https://github.com/python/cpython/blob/cae55542d23e606dde9819d5dadd7430085fcc77/Parser/string_parser.c#L559 Will help folks to look backwards (close to open as well) than forwards (open to close) as in Matt's case which is also a valid interpretation where there is an opening paren outside the f-string. or simply "f-string: unmatched '%c' or missing '}'" will also do. -- nosy: +williamnavaraj ___ Python tracker <https://bugs.python.org/issue46260> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46275] caret location for syntax error pointing with f-strings
New submission from William Navaraj : Currently for non-f-string syntax errors, the caret points to the correct location of the syntax errors Example 1: ``` a=foo)+foo()+foo() ``` a=foo)+foo()+foo() ^ SyntaxError: unmatched ')' For f-string syntax errors, the caret points two locations after the f-string (almost correct location of the f-strings as a whole but will be more helpful as much as possible to point where exactly the syntax error is) Example 2: ``` temp=f"blank ({foo(}" ``` temp=f"blank ({foo(}" ^ SyntaxError: f-string: closing parenthesis '}' does not match opening parenthesis '(' Example 3: ``` temp=f"blank ({foo)blank ({foo()}) blank foo()})" ``` temp=f"blank ({foo)blank ({foo()}) blank foo()})" ^ SyntaxError: f-string: unmatched ')' -- components: Parser messages: 409813 nosy: lys.nikolaou, pablogsal, williamnavaraj priority: normal severity: normal status: open title: caret location for syntax error pointing with f-strings versions: Python 3.11, Python 3.8 ___ Python tracker <https://bugs.python.org/issue46275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46275] caret location for syntax error pointing with f-strings
William Navaraj added the comment: A potential solution or in that direction https://github.com/williamnavaraj/cpython/tree/fix-issue-46275 Example 1: ``` temp=f"blank {foo)" ``` temp=f"blank {foo)" ^ SyntaxError: f-string: unmatched ')' Example 2: ``` temp=f"blank ({foo)foo2" ``` temp=f"blank ({foo)foo2" ^ SyntaxError: f-string: unmatched ')' Example 3: ``` temp=f"blank ({foo)blank ({foo()}) blank foo()})" ``` temp=f"blank ({foo)blank ({foo()}) blank foo()})" ^ SyntaxError: f-string: unmatched ')' -- ___ Python tracker <https://bugs.python.org/issue46275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26571] turtle regression in 3.5
William Navaraj added the comment: Hi all, Sorry. I seem to have stepped on someone's toes or no one likes turtle any more (as this is active since 2016). As you can see, I am new here and still getting a feel for these procedures. I was preparing a Jupyter notebook for my students. I planned some exercises with turtle at start before we jump into real robots. I noticed this annoying Terminator error, digged deeper into the code to find about the _RUNNING class variable. The PR from Furkan suggest to remove the Raise Terminator. May be we could amend that and I will close my PR, if you prefer. Thanks, -- ___ Python tracker <https://bugs.python.org/issue26571> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46275] caret location for syntax error pointing with f-strings
William Navaraj added the comment: The variation in the caret position was also due to the trailing spaces. This is now sorted in this solution with a factored out function to find out the correct offset. https://github.com/python/cpython/compare/main...williamnavaraj:fix-issue-46275?expand=1 Tested against all of the following cases and it works great: temp=f"blank ({foo()}"+f"blank ({foo(}"+f"blank ({foo()}" temp=f"blank*{foo(*blank*foo()*blank*foo()}"+f"({foo(}"+f"blank ({foo(}" a=foo)+foo()+foo() f"blank ({foo(blank ({foo()}) blank foo()})" temp=f"blank ({foo)foo2" temp=f"blank {foo)" temp=f"blank {foo)" temp=f"blank ({foo)blank ({foo()}) blank foo()})" yetAnotherBlah temp=f"blank ({foo)blank ({foo()}) blank foo()})" yetAnotherBlahWithFurtherSpacesAfter -- ___ Python tracker <https://bugs.python.org/issue46275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com