bpo-41746: Add type information to asdl_seq objects (GH-22223)
* Add new capability to the PEG parser to type variable assignments. For instance:
```
| a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a }
```
* Add new sequence types from the asdl definition (automatically generated)
* Make `asdl_seq` type a generic aliasing pointer type.
* Create a new `asdl_generic_seq` for the generic case using `void*`.
* The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed.
* New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences.
* Changes all possible `asdl_seq` types to use specific versions everywhere.
diff --git a/Parser/string_parser.c b/Parser/string_parser.c
index 2c35da5..1285968 100644
--- a/Parser/string_parser.c
+++ b/Parser/string_parser.c
@@ -970,15 +970,15 @@
l->size = -1;
}
-static asdl_seq *
+static asdl_expr_seq *
ExprList_Finish(ExprList *l, PyArena *arena)
{
- asdl_seq *seq;
+ asdl_expr_seq *seq;
ExprList_check_invariants(l);
/* Allocate the asdl_seq and copy the expressions in to it. */
- seq = _Py_asdl_seq_new(l->size, arena);
+ seq = _Py_asdl_expr_seq_new(l->size, arena);
if (seq) {
Py_ssize_t i;
for (i = 0; i < l->size; i++) {
@@ -1167,7 +1167,7 @@
_PyPegen_FstringParser_Finish(Parser *p, FstringParser *state, Token* first_token,
Token *last_token)
{
- asdl_seq *seq;
+ asdl_expr_seq *seq;
FstringParser_check_invariants(state);