aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-01-26 00:40:57 +0100
committerVictor Stinner <victor.stinner@gmail.com>2016-01-26 00:40:57 +0100
commitf2c1aa1661edb3e14ff8b7b9995f93e303c8acbb (patch)
tree2b05f347dd55b86059d70197ce3d21210a668f91 /Include/asdl.h
parentTests versus zero are more compact than tests versus -1. (diff)
downloadcpython-f2c1aa1661edb3e14ff8b7b9995f93e303c8acbb.tar.gz
cpython-f2c1aa1661edb3e14ff8b7b9995f93e303c8acbb.tar.bz2
cpython-f2c1aa1661edb3e14ff8b7b9995f93e303c8acbb.zip
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 'Include/asdl.h')
-rw-r--r--Include/asdl.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/asdl.h b/Include/asdl.h
index 495153c576f..35e9fa18601 100644
--- a/Include/asdl.h
+++ b/Include/asdl.h
@@ -6,6 +6,7 @@ typedef PyObject * string;
typedef PyObject * bytes;
typedef PyObject * object;
typedef PyObject * singleton;
+typedef PyObject * constant;
/* It would be nice if the code generated by asdl_c.py was completely
independent of Python, but it is a goal the requires too much work