Matthias Bussonnier <[email protected]> added the comment:
Seem to not be in the new parser but simply in codeop in particular `def
_maybe_compile`
The logic seem weird (but weird logic usually have a reason), it try to compile
thrice by appending many `\n`.
1) Why do that and not return the first successful compile directly ? I'm not
sure.
2) It does compare the repr of error when compile(source + "\n") and
compile(source+'\n\n') and only raise if both are identical (which they are not
in the new parser, they differ by `\n`...)
SyntaxError('invalid syntax', ('<input>', 1, 6, 'def a-b'))
vs
SyntaxError('invalid syntax', ('<input>', 1, 6, 'def a-b\n'))
This logic seem to go back to the 2000s.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40334>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com