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 grantjenks, terry.reedy
Date 2018-07-05.21:58:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The SyntaxError is not relevant.  Interactive CPython:

>>> d=[]
>>> d=()
>>> d={}

Erroneous extra lines in IDLE 3.6+ Shell but not editor:

>>> d = []
>>> d=()
>>> d={}
>>> d=[i for i in [1]]

The 'blank' lines are indents produced by IDLE's smart indent mechanism, which is trigger by keying '\n', *before* the code is tentatively compiled.

While the extra lines are an error for the examples above, they are arguably correct for your example, where there is no closing '}'.  The indenter treats it the same as if there were a closing quote, as in the following, which *is* the same in shell and editor, and correct.

d = {1: 'one}'
     # Indent lines up next dict item with the one above.

Even though your example is no a bug, it lead me to discover a regression in current 3.6+.  In the past year, there have been a couple of patches that touched the autoindent code.
Date User Action Args
2018-07-05 21:58:25terry.reedysetrecipients: + terry.reedy, grantjenks
2018-07-05 21:58:25terry.reedysetmessageid: <>
2018-07-05 21:58:25terry.reedylinkissue34055 messages
2018-07-05 21:58:25terry.reedycreate