Terry J. Reedy added the comment:

If src is effectively blank, compile(src, filename, mode) raises SyntaxError if 
mode is 'single' but not if it is 'exec'.  I believe IDLE compiles with 
'single', but it has the behavior Jim (and I) expect and consider correct, 
printing '>>>' after effectively blank lines.  This is because IDLE uses 
code.InteractiveInterpreter, which uses codeop.compile_command, which uses 
codeop._maybe_compile, which replaces effectively blank statements with 'pass'. 
 compile('pass', '', 'single') returns a do-nothing code object.  The C-coded 
interactive interpreter is doing something else.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29561>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to