summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-12-06 17:41:04 -0500
committerBenjamin Peterson <benjamin@python.org>2012-12-06 17:41:04 -0500
commit442f20996dcd994d1024e5cad7f66a4595352eb2 (patch)
tree641746efd4247acd2b5e13f5de7f65c026242a05 /Include
parent4b237e3b1112304f834ac78fe05abdecbf3d87b4 (diff)
downloadcpython-git-442f20996dcd994d1024e5cad7f66a4595352eb2.tar.gz
create NameConstant AST class for None, True, and False literals (closes #16619)
Diffstat (limited to 'Include')
-rw-r--r--Include/Python-ast.h12
-rw-r--r--Include/asdl.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 7ad6cb370b..9d88d5d616 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -182,8 +182,9 @@ enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4,
SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11,
Yield_kind=12, YieldFrom_kind=13, Compare_kind=14,
Call_kind=15, Num_kind=16, Str_kind=17, Bytes_kind=18,
- Ellipsis_kind=19, Attribute_kind=20, Subscript_kind=21,
- Starred_kind=22, Name_kind=23, List_kind=24, Tuple_kind=25};
+ NameConstant_kind=19, Ellipsis_kind=20, Attribute_kind=21,
+ Subscript_kind=22, Starred_kind=23, Name_kind=24,
+ List_kind=25, Tuple_kind=26};
struct _expr {
enum _expr_kind kind;
union {
@@ -279,6 +280,10 @@ struct _expr {
} Bytes;
struct {
+ singleton value;
+ } NameConstant;
+
+ struct {
expr_ty value;
identifier attr;
expr_context_ty ctx;
@@ -509,6 +514,9 @@ expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena);
expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena);
#define Bytes(a0, a1, a2, a3) _Py_Bytes(a0, a1, a2, a3)
expr_ty _Py_Bytes(bytes s, int lineno, int col_offset, PyArena *arena);
+#define NameConstant(a0, a1, a2, a3) _Py_NameConstant(a0, a1, a2, a3)
+expr_ty _Py_NameConstant(singleton value, int lineno, int col_offset, PyArena
+ *arena);
#define Ellipsis(a0, a1, a2) _Py_Ellipsis(a0, a1, a2)
expr_ty _Py_Ellipsis(int lineno, int col_offset, PyArena *arena);
#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5)
diff --git a/Include/asdl.h b/Include/asdl.h
index 6bf618f3e9..0789ad870b 100644
--- a/Include/asdl.h
+++ b/Include/asdl.h
@@ -5,6 +5,7 @@ typedef PyObject * identifier;
typedef PyObject * string;
typedef PyObject * bytes;
typedef PyObject * object;
+typedef PyObject * singleton;
/* 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