[issue43366] Unclosed bracket bug in code.interact prevents identifying syntax errors

Pablo Galindo Salgado report at bugs.python.org
Fri Mar 5 22:50:20 EST 2021


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

> "If mode is 'repl', compile returns None to indicate that the code is incomplete as is but might become valid if more lines (or maybe just more code) were added"

That would be ideal, but my guess is that is not trivial because even if you can intercept the tokenizer when it fetches new lines from the source, you need to correctly propagate that information through several tokenized layers and the parser trying to backtrack.

If someone manages to do that, that would be the cleanest solution.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43366>
_______________________________________


More information about the Python-bugs-list mailing list