Backport 52621:
Bug #1588287: fix invalid assertion for `1,2` in debug builds.
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index c39e416..76483f6 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -709,6 +709,7 @@
x = `x`
x = `1 or 2 or 3`
+x = `1,2`
x = x
x = 'x'
x = 123
diff --git a/Misc/NEWS b/Misc/NEWS
index 8db0bc4..9631d4f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@
Core and builtins
-----------------
+- Bug #1588287: fix invalid assertion for `1,2` in debug builds.
+
- Bug #1576657: when setting a KeyError for a tuple key, make sure that
the tuple isn't used as the "exception arguments tuple".
diff --git a/Python/ast.c b/Python/ast.c
index 52c098f..6551063 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -538,6 +538,7 @@
|| TYPE(n) == listmaker
|| TYPE(n) == testlist_gexp
|| TYPE(n) == testlist_safe
+ || TYPE(n) == testlist1
);
seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena);