diff options
author | Eric V. Smith <ericvsmith@users.noreply.github.com> | 2019-05-08 20:28:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 20:28:48 (GMT) |
commit | 9a4135e939bc223f592045a38e0f927ba170da32 (patch) | |
tree | de347c6f2df801dc98b36ab5084dada335741517 /Python/ast_unparse.c | |
parent | 65d98d0f53f558d7c799098da0abf376068c15fd (diff) | |
download | cpython-9a4135e939bc223f592045a38e0f927ba170da32.zip cpython-9a4135e939bc223f592045a38e0f927ba170da32.tar.gz cpython-9a4135e939bc223f592045a38e0f927ba170da32.tar.bz2 |
bpo-36817: Add f-string debugging using '='. (GH-13123)
If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
Diffstat (limited to 'Python/ast_unparse.c')
-rw-r--r-- | Python/ast_unparse.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/ast_unparse.c b/Python/ast_unparse.c index 916ad5f..25a5c69 100644 --- a/Python/ast_unparse.c +++ b/Python/ast_unparse.c @@ -655,6 +655,11 @@ append_formattedvalue(_PyUnicodeWriter *writer, expr_ty e, bool is_format_spec) } Py_DECREF(temp_fv_str); + if (e->v.FormattedValue.expr_text) { + /* Use the = for debug text expansion. */ + APPEND_STR("="); + } + if (e->v.FormattedValue.conversion > 0) { switch (e->v.FormattedValue.conversion) { case 'a': |