mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
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.
This commit is contained in:
parent
65d98d0f53
commit
9a4135e939
11 changed files with 286 additions and 49 deletions
|
@ -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':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue