bpo-34013: Generalize the invalid legacy statement error message (GH-27389)

This commit is contained in:
Pablo Galindo Salgado 2021-07-27 17:19:22 +01:00 committed by GitHub
parent 2f54fbafa6
commit 6948964ecf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 337 additions and 244 deletions

View file

@ -77,6 +77,18 @@ _PyPegen_check_barry_as_flufl(Parser *p, Token* t) {
return 0;
}
int
_PyPegen_check_legacy_stmt(Parser *p, expr_ty name) {
assert(name->kind == Name_kind);
const char* candidates[2] = {"print", "exec"};
for (int i=0; i<2; i++) {
if (PyUnicode_CompareWithASCIIString(name->v.Name.id, candidates[i]) == 0) {
return 1;
}
}
return 0;
}
PyObject *
_PyPegen_new_identifier(Parser *p, const char *n)
{