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 terry.reedy
Recipients cben, eric.araujo, kbk, terry.reedy
Date 2010-08-20.18:15:29
SpamBayes Score 1.36598e-06
Marked as misclassified No
Message-id <>
In interactive mode, multiline statements are terminated with a blank line. Your examples lacks that, so the 3rd line is part of the def and lacking the proper indent, is indeed a syntax error. You get the same with the standard command-line interpreter.
>>> def f():
...     return 42
... f()
  File "<stdin>", line 3
SyntaxError: invalid syntax

That said, adding a blank line still gives a syntax error in IDLE, instead of ignoring the extra statement, while the interpreter prints 42. IDLE requires an explicit blank line from the keyboard to terminate compound statements; pasted blank lines do not count #3559 (which I now see you commented on - I should have been notified but was not).

I suspect you are correct about the dependency on code.InteractiveConsole(), but I have not looked at the IDLE code either.

In the meanwhile, either paste multiple statements in the the real interpreter or into an IDLE window and use F5 run.
Date User Action Args
2010-08-20 18:15:32terry.reedysetrecipients: + terry.reedy, kbk, cben, eric.araujo
2010-08-20 18:15:32terry.reedysetmessageid: <>
2010-08-20 18:15:30terry.reedylinkissue9618 messages
2010-08-20 18:15:29terry.reedycreate