Message200948
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. |
|
Date |
User |
Action |
Args |
2013-10-22 13:37:18 | ncoghlan | set | recipients:
+ ncoghlan, terry.reedy, r.david.murray, Mark.Shannon, Rosuav, Esa.Peuha |
2013-10-22 13:37:18 | ncoghlan | link | issue19335 messages |
2013-10-22 13:37:17 | ncoghlan | create | |
|