New submission from Guido van Rossum <gu...@python.org>:
Example: >>> compile("pass\n(1+)\npass", "<string>", "exec") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "", line 2 (1+) pass ^ SyntaxError: invalid syntax >>> Note that the input is pass (1+) pass The second "pass" (and in fact the entire file) leaks into the SyntaxError object's text attribute. This only happens when the file (here "<string>") cannot be read. It's not specific to compile(), it seems fundamental in the C-level pegen API. ---------- keywords: 3.4regression messages: 368815 nosy: gvanrossum priority: normal severity: normal stage: needs patch status: open title: compile() passes rest of file as SyntaxError().text when file unreadable type: behavior versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40619> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com