summaryrefslogtreecommitdiffstats
path: root/Parser/pegen.c
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-11-19 23:11:57 (GMT)
committerGitHub <noreply@github.com>2021-11-19 23:11:57 (GMT)
commit546cefcda75d7150b55c8bc1724bea35a1e12890 (patch)
tree18d9c398c5d6cdc610bffcedfc74a82c5250a0c6 /Parser/pegen.c
parentc8c21bdd199f9feb75fc6cdb398a686dc133b99f (diff)
downloadcpython-546cefcda75d7150b55c8bc1724bea35a1e12890.zip
cpython-546cefcda75d7150b55c8bc1724bea35a1e12890.tar.gz
cpython-546cefcda75d7150b55c8bc1724bea35a1e12890.tar.bz2
bpo-45727: Make the syntax error for missing comma more consistent (GH-29427)
Diffstat (limited to 'Parser/pegen.c')
-rw-r--r--Parser/pegen.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 15879a6..09c1a19 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -79,7 +79,9 @@ _PyPegen_check_barry_as_flufl(Parser *p, Token* t) {
int
_PyPegen_check_legacy_stmt(Parser *p, expr_ty name) {
- assert(name->kind == Name_kind);
+ if (name->kind != Name_kind) {
+ return 0;
+ }
const char* candidates[2] = {"print", "exec"};
for (int i=0; i<2; i++) {
if (PyUnicode_CompareWithASCIIString(name->v.Name.id, candidates[i]) == 0) {