mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -3435,13 +3435,15 @@ main_loop:
|
|||
|
||||
/* See if any conversion is specified. */
|
||||
switch (which_conversion) {
|
||||
case FVC_NONE: conv_fn = NULL; break;
|
||||
case FVC_STR: conv_fn = PyObject_Str; break;
|
||||
case FVC_REPR: conv_fn = PyObject_Repr; break;
|
||||
case FVC_ASCII: conv_fn = PyObject_ASCII; break;
|
||||
|
||||
/* Must be 0 (meaning no conversion), since only four
|
||||
values are allowed by (oparg & FVC_MASK). */
|
||||
default: conv_fn = NULL; break;
|
||||
default:
|
||||
PyErr_Format(PyExc_SystemError,
|
||||
"unexpected conversion flag %d",
|
||||
which_conversion);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* If there's a conversion function, call it and replace
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue