mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-34013: Generalize the invalid legacy statement error message (GH-27389)
This commit is contained in:
parent
2f54fbafa6
commit
6948964ecf
6 changed files with 337 additions and 244 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue