summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'Parser')
-rw-r--r--Parser/Python.asdl2
-rw-r--r--[-rwxr-xr-x]Parser/asdl_c.py2
-rw-r--r--Parser/tokenizer.c10
3 files changed, 9 insertions, 5 deletions
diff --git a/Parser/Python.asdl b/Parser/Python.asdl
index cd0832d..22775c6 100644
--- a/Parser/Python.asdl
+++ b/Parser/Python.asdl
@@ -71,6 +71,8 @@ module Python
| Call(expr func, expr* args, keyword* keywords)
| Num(object n) -- a number as a PyObject.
| Str(string s) -- need to specify raw, unicode, etc?
+ | FormattedValue(expr value, int? conversion, expr? format_spec)
+ | JoinedStr(expr* values)
| Bytes(bytes s)
| NameConstant(singleton value)
| Ellipsis
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index f38c253..eedd89b 100755..100644
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -906,7 +906,7 @@ static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
return 1;
}
- i = (int)PyLong_AsLong(obj);
+ i = _PyLong_AsInt(obj);
if (i == -1 && PyErr_Occurred())
return 1;
*out = i;
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 6a528db..cdb5103 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1475,17 +1475,19 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
nonascii = 0;
if (is_potential_identifier_start(c)) {
/* Process b"", r"", u"", br"" and rb"" */
- int saw_b = 0, saw_r = 0, saw_u = 0;
+ int saw_b = 0, saw_r = 0, saw_u = 0, saw_f = 0;
while (1) {
- if (!(saw_b || saw_u) && (c == 'b' || c == 'B'))
+ if (!(saw_b || saw_u || saw_f) && (c == 'b' || c == 'B'))
saw_b = 1;
/* Since this is a backwards compatibility support literal we don't
want to support it in arbitrary order like byte literals. */
- else if (!(saw_b || saw_u || saw_r) && (c == 'u' || c == 'U'))
+ else if (!(saw_b || saw_u || saw_r || saw_f) && (c == 'u' || c == 'U'))
saw_u = 1;
/* ur"" and ru"" are not supported */
else if (!(saw_r || saw_u) && (c == 'r' || c == 'R'))
saw_r = 1;
+ else if (!(saw_f || saw_b || saw_u) && (c == 'f' || c == 'F'))
+ saw_f = 1;
else
break;
c = tok_nextc(tok);
@@ -1739,7 +1741,7 @@ tok_get(struct tok_state *tok, char **p_start, char **p_end)
else {
end_quote_size = 0;
if (c == '\\')
- c = tok_nextc(tok); /* skip escaped char */
+ c = tok_nextc(tok); /* skip escaped char */
}
}