Meador Inge <mead...@gmail.com> added the comment: The attached patch fixes this be checking what is left in the input buffer after parsing. Anything but trailing whitespace and comments triggers the exception.
Ignoring trailing whitespace and comments makes sense, but it is also somewhat required. Trailing comments are common in doctests: >>> doctest.testfile('test_doctest.txt', raise_on_error=True) ... # doctest: +ELLIPSIS and trailing whitespace is used by the codeop heuristics. Here is an example of the new exception: >>> compile('1 + 2\n3 + 4\n', '','single') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "", line 1 1 + 2 ^ SyntaxError: multiple statements found while compiling a single statement Tested on Fedora 15; no regressions. ---------- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file24262/issue12705-0.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12705> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com