diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-09-16 18:42:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-16 18:42:00 (GMT) |
commit | a5634c406767ef694df49b624adf9cfa6c0d9064 (patch) | |
tree | d0fccb7521e88e3528d5265bf0209f1554fd0098 /Python/ast_unparse.c | |
parent | 5c1b46d897d4c693e2f3ae049d54725dfb09f2dc (diff) | |
download | cpython-a5634c406767ef694df49b624adf9cfa6c0d9064.zip cpython-a5634c406767ef694df49b624adf9cfa6c0d9064.tar.gz cpython-a5634c406767ef694df49b624adf9cfa6c0d9064.tar.bz2 |
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.
Diffstat (limited to 'Python/ast_unparse.c')
-rw-r--r-- | Python/ast_unparse.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c index e699751..a04ff93 100644 --- a/Python/ast_unparse.c +++ b/Python/ast_unparse.c @@ -117,7 +117,7 @@ static int append_ast_boolop(_PyUnicodeWriter *writer, expr_ty e, int level) { Py_ssize_t i, value_count; - asdl_seq *values; + asdl_expr_seq *values; const char *op = (e->v.BoolOp.op == And) ? " and " : " or "; int pr = (e->v.BoolOp.op == And) ? PR_AND : PR_OR; @@ -398,7 +398,7 @@ append_ast_comprehension(_PyUnicodeWriter *writer, comprehension_ty gen) } static int -append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_seq *comprehensions) +append_ast_comprehensions(_PyUnicodeWriter *writer, asdl_comprehension_seq *comprehensions) { Py_ssize_t i, gen_count; gen_count = asdl_seq_LEN(comprehensions); @@ -453,7 +453,7 @@ append_ast_compare(_PyUnicodeWriter *writer, expr_ty e, int level) { const char *op; Py_ssize_t i, comparator_count; - asdl_seq *comparators; + asdl_expr_seq *comparators; asdl_int_seq *ops; APPEND_STR_IF(level > PR_CMP, "("); @@ -612,7 +612,7 @@ append_fstring_element(_PyUnicodeWriter *writer, expr_ty e, bool is_format_spec) /* Build body separately to enable wrapping the entire stream of Strs, Constants and FormattedValues in one opening and one closing quote. */ static PyObject * -build_fstring_body(asdl_seq *values, bool is_format_spec) +build_fstring_body(asdl_expr_seq *values, bool is_format_spec) { Py_ssize_t i, value_count; _PyUnicodeWriter body_writer; |