Message151461
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. |
|
Date |
User |
Action |
Args |
2012-01-17 15:52:08 | meador.inge | set | recipients:
+ meador.inge, terry.reedy, benjamin.peterson, Devin Jeanpierre, eric.araujo |
2012-01-17 15:52:07 | meador.inge | set | messageid: <1326815527.92.0.678129151244.issue12705@psf.upfronthosting.co.za> |
2012-01-17 15:52:07 | meador.inge | link | issue12705 messages |
2012-01-17 15:52:07 | meador.inge | create | |
|