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 taleinat, terry.reedy
Date 2021-06-06.22:48:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I added debug prints to _maybe_compile and confirmed

1) trailing whitespace (' ' and '\t' at least) is removed before this function is called.  I presume in IDLE rather than code.II, but cannot find where.  It is not with .rstrip.  (Note: doing so after '\' is a bug in that it lets buggy input such as 'a\ \n  + 2' run instead of raising.)

2. code is otherwise delivered intact and blanks lines become 'pass'.  Thus any difference noted above is not due to compile().

The report was based on Windows with 3.9.5, 3.10.0b2, and fresh main.  I repeated the Shell experiments on a Mac Airbook, and a slower machine, with 3.10.b1.  There was never a spurious ... -- once the proper >>> was printed.  However, I sometimes saw ... appear very briefly, only to be overwritten with >>>.  (I saw this once, *very briefly*, on Windows with main, on the first comment I tried.)  I also saw ... appear and disappear when there was a SyntaxError or print output.  I suspect that Sidebar always adds ..., only to be deleted or overwritten when it is a mistake.

I then tried 3.9.5 on the Mac and saw a spurious blank line with ' # a' once, on the first try, but not again in several attempts.  There seems to be a 'warmup' effect.

My conclusion so far: sidebar might be a culprit, but because of the 3.9 behavior, I think it more likely a victim of pyshell prematurely marking the new line as a possible continuation line.  As long as there was not continuation prompt, this might seem innocuous.  But it might also be a factor in other spurious blank lines.  In particular,

>>> if 1: # Hit return on indented line.
...     print(2)
...     < undeleted 4 space indent
>>> if 1: # Delete indent first.  Get proper behavior.
...     print(2)

I am stopping here.  Tal, what do you think with your better knowledge of pyshell internals?
Date User Action Args
2021-06-06 22:48:18terry.reedysetrecipients: + terry.reedy, taleinat
2021-06-06 22:48:18terry.reedysetmessageid: <>
2021-06-06 22:48:18terry.reedylinkissue44325 messages
2021-06-06 22:48:18terry.reedycreate