This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients Devin Jeanpierre, benjamin.peterson, eric.araujo, meador.inge, terry.reedy
Date 2012-01-17.15:52:06
SpamBayes Score 5.800014e-10
Marked as misclassified No
Message-id <1326815527.92.0.678129151244.issue12705@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-01-17 15:52:08meador.ingesetrecipients: + meador.inge, terry.reedy, benjamin.peterson, Devin Jeanpierre, eric.araujo
2012-01-17 15:52:07meador.ingesetmessageid: <1326815527.92.0.678129151244.issue12705@psf.upfronthosting.co.za>
2012-01-17 15:52:07meador.ingelinkissue12705 messages
2012-01-17 15:52:07meador.ingecreate