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 pablogsal
Recipients Esa.Peuha, Mark.Shannon, RJ722, Rosuav, cheryl.sabella, lys.nikolaou, mbussonn, ncoghlan, pablogsal, r.david.murray, terry.reedy
Date 2020-06-29.12:55:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593435324.77.0.759141811284.issue19335@roundup.psfhosted.org>
In-reply-to
Content
> Pablo, correct me if I'm wrong, but I think that the parser has nothing to do with this. It's not the parser that produces this SyntaxError, it's some later compilation phase (I guess symtable creation phase?), which I know very very little about, so I can't really offer an opinion on what can be done.

Yeah, this is correct the parser has nothing to be done with this, what is involved in this is the compiler, as the generated AST looks correct.

>  When the new parser compiles a function, does it know or could it know whether it is nested?

Nop, the parser does not even know what a 'function' is while it parses, as that is only determined in the product of the parser itself: the AST. The piece that understands semantically what a function is and if is nested or not is the compiler.

> Parsing should not care about statement semantics, in that a nonlocal statement should be like any other statement in the parser's point of view.

Yup, I very much agree with this. The parser must not know about the semantics of the AST elements (forcing it to do so will be not only very complex but also will make maintenance much more difficult as the parser will be coupled with the semantics of the language is parsing as opposed to only having to know about the grammar).

> All in all, I think that Nick's hack is the way to go here, since it's comc's responsibility to correctly check if a statement is incomplete, right?

If I understand correctly, Nick is talking about modifying the different iterations for different errors in codeop no?
History
Date User Action Args
2020-06-29 12:55:24pablogsalsetrecipients: + pablogsal, terry.reedy, ncoghlan, r.david.murray, Mark.Shannon, Rosuav, Esa.Peuha, mbussonn, cheryl.sabella, lys.nikolaou, RJ722
2020-06-29 12:55:24pablogsalsetmessageid: <1593435324.77.0.759141811284.issue19335@roundup.psfhosted.org>
2020-06-29 12:55:24pablogsallinkissue19335 messages
2020-06-29 12:55:24pablogsalcreate