example. */
static expr_ty
fstring_compile_expr(PyObject *str, Py_ssize_t expr_start,
- Py_ssize_t expr_end, PyArena *arena)
+ Py_ssize_t expr_end, struct compiling *c, const node *n)
+
{
PyCompilerFlags cf;
mod_ty mod;
}
}
if (all_whitespace) {
- PyErr_SetString(PyExc_SyntaxError, "f-string: empty expression "
- "not allowed");
+ ast_error(c, n, "f-string: empty expression not allowed");
goto error;
}
cf.cf_flags = PyCF_ONLY_AST;
mod = PyParser_ASTFromString(utf_expr, "<fstring>",
- Py_eval_input, &cf, arena);
+ Py_eval_input, &cf, c->c_arena);
if (!mod)
goto error;
/* Compile the expression as soon as possible, so we show errors
related to the expression before errors related to the
conversion or format_spec. */
- simple_expression = fstring_compile_expr(str, expr_start, expr_end,
- c->c_arena);
+ simple_expression = fstring_compile_expr(str, expr_start, expr_end, c, n);
if (!simple_expression)
return -1;