New submission from Guido van Rossum <gu...@python.org>:
I just noticed a subtle discrepancy between the old parser and the PEG parser. Consider this syntax error: ``` if x {a}: pass ``` The old parser places the caret at the '{': ``` $ python3.8 -c 'if x { a } : pass' File "<string>", line 1 if x { a } : pass ^ SyntaxError: invalid syntax ``` The PEG parser puts it at 'a': ``` $ python3.10 -c 'if x { a } : pass' File "<string>", line 1 if x { a } : pass ^ SyntaxError: invalid syntax ``` I don't think we should put much effort into fixing it -- it's just a curiosity. I suspect it's got to do with some lookahead. ---------- assignee: lys.nikolaou messages: 376048 nosy: gvanrossum, lys.nikolaou priority: low severity: normal stage: needs patch status: open title: PEG discrepancy on 'if {x} {a}: pass' type: behavior versions: Python 3.10, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41659> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com