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 ncoghlan
Recipients Esa.Peuha, Mark.Shannon, Rosuav, ncoghlan, r.david.murray, terry.reedy
Date 2013-10-22.13:37:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CADiSq7cGheoD6V5mfKR09+BGB_pX2fG33hqduQ302oPWw9TU_A@mail.gmail.com>
In-reply-to <1382448070.81.0.830800465997.issue19335@psf.upfronthosting.co.za>
Content
codeop compiles the whole pending statement every time, so that part
shouldn't be needed (from the compiler's point of view, this input
looks complete - there's nothing dangling, any more than there is for
a normal syntax error like "name name"). As far as I can tell, the
only reason it works in the internal parser case is because the parser
doesn't consider the input complete until it sees the expected
dedents, which the tokenizer doesn't generate until it sees the
trailing newline.

That may actually be another alternative: instead of doing the "try
appending newlines and see if it works or generates different errors",
we may be able to switch to the tokenizer if the initial compilation
fails and check for hanging INDENT tokens (i.e. INDENTS without a
corresponding DEDENT). That would get us much closer to what the real
eval loop is doing.
History
Date User Action Args
2013-10-22 13:37:18ncoghlansetrecipients: + ncoghlan, terry.reedy, r.david.murray, Mark.Shannon, Rosuav, Esa.Peuha
2013-10-22 13:37:18ncoghlanlinkissue19335 messages
2013-10-22 13:37:17ncoghlancreate