summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2019-03-13 20:00:46 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-03-13 20:00:46 (GMT)
commit10f8ce66884cd7fee2372b8dae08ca8132091574 (patch)
treea303475519567ad973a7a961c61f613c90003d3a /Include
parent8b5bdda5b4c418c4a858f183763d0a497170977c (diff)
downloadcpython-10f8ce66884cd7fee2372b8dae08ca8132091574.zip
cpython-10f8ce66884cd7fee2372b8dae08ca8132091574.tar.gz
cpython-10f8ce66884cd7fee2372b8dae08ca8132091574.tar.bz2
bpo-36280: Add Constant.kind field (GH-12295)
The value is a string for string and byte literals, None otherwise. It is 'u' for u"..." literals, 'b' for b"..." literals, '' for "..." literals. The 'r' (raw) prefix is ignored. Does not apply to f-strings. This appears sufficient to make mypy capable of using the stdlib ast module instead of typed_ast (assuming a mypy patch I'm working on). WIP: I need to make the tests pass. @ilevkivskyi @serhiy-storchaka https://bugs.python.org/issue36280
Diffstat (limited to 'Include')
-rw-r--r--Include/Python-ast.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 8265bed..a5742ff 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -338,6 +338,7 @@ struct _expr {
struct {
constant value;
+ string kind;
} Constant;
struct {
@@ -642,9 +643,9 @@ expr_ty _Py_FormattedValue(expr_ty value, int conversion, expr_ty format_spec,
#define JoinedStr(a0, a1, a2, a3, a4, a5) _Py_JoinedStr(a0, a1, a2, a3, a4, a5)
expr_ty _Py_JoinedStr(asdl_seq * values, int lineno, int col_offset, int
end_lineno, int end_col_offset, PyArena *arena);
-#define Constant(a0, a1, a2, a3, a4, a5) _Py_Constant(a0, a1, a2, a3, a4, a5)
-expr_ty _Py_Constant(constant value, int lineno, int col_offset, int
- end_lineno, int end_col_offset, PyArena *arena);
+#define Constant(a0, a1, a2, a3, a4, a5, a6) _Py_Constant(a0, a1, a2, a3, a4, a5, a6)
+expr_ty _Py_Constant(constant value, string kind, int lineno, int col_offset,
+ int end_lineno, int end_col_offset, PyArena *arena);
#define Attribute(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Attribute(a0, a1, a2, a3, a4, a5, a6, a7)
expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int
lineno, int col_offset, int end_lineno, int