diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-01-26 00:40:57 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-01-26 00:40:57 +0100 |
commit | 05b0626e91b9f17c0f0be156917a0d087d5724ae (patch) | |
tree | c0c86a4ffb596ab21911301ccf9159ab34b2d6f0 /Python/symtable.c | |
parent | 54d491fcd85578bad3639eb4e742f73fb1c07aff (diff) | |
download | cpython-05b0626e91b9f17c0f0be156917a0d087d5724ae.tar.gz |
Add ast.Constant
Issue #26146: Add a new kind of AST node: ast.Constant. It can be used by
external AST optimizers, but the compiler does not emit directly such node.
An optimizer can replace the following AST nodes with ast.Constant:
* ast.NameConstant: None, False, True
* ast.Num: int, float, complex
* ast.Str: str
* ast.Bytes: bytes
* ast.Tuple if items are constants too: tuple
* frozenset
Update code to accept ast.Constant instead of ast.Num and/or ast.Str:
* compiler
* docstrings
* ast.literal_eval()
* Tools/parser/unparse.py
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index 9f5149f8d0..558bb06bd3 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1455,6 +1455,7 @@ symtable_visit_expr(struct symtable *st, expr_ty e) case JoinedStr_kind: VISIT_SEQ(st, expr, e->v.JoinedStr.values); break; + case Constant_kind: case Num_kind: case Str_kind: case Bytes_kind: |