diff options
author | Eric V. Smith <ericvsmith@users.noreply.github.com> | 2019-05-08 16:28:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 16:28:48 -0400 |
commit | 9a4135e939bc223f592045a38e0f927ba170da32 (patch) | |
tree | de347c6f2df801dc98b36ab5084dada335741517 /Python/ceval.c | |
parent | 65d98d0f53f558d7c799098da0abf376068c15fd (diff) | |
download | cpython-git-9a4135e939bc223f592045a38e0f927ba170da32.tar.gz |
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/ceval.c')
-rw-r--r-- | Python/ceval.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e616a3f539..4e43df2713 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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 |