summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-06-14 15:15:08 (GMT)
committerGitHub <noreply@github.com>2023-06-14 15:15:08 (GMT)
commit1d857da7f0e4858e561223f319ae5afe737d5657 (patch)
treeebfa22004b373a48769f42f002ed401248cdd3ea /Python/ceval.c
parent307bceaa65c4f1a8e110cd7a9cce6e93a1b021ba (diff)
downloadcpython-1d857da7f0e4858e561223f319ae5afe737d5657.zip
cpython-1d857da7f0e4858e561223f319ae5afe737d5657.tar.gz
cpython-1d857da7f0e4858e561223f319ae5afe737d5657.tar.bz2
GH-77273: Better bytecodes for f-strings (GH-6132)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 54ef037..b628190 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -222,6 +222,14 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, PyFunctionObject *func,
static void
_PyEvalFrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame);
+typedef PyObject *(*convertion_func_ptr)(PyObject *);
+
+static const convertion_func_ptr CONVERSION_FUNCTIONS[4] = {
+ [FVC_STR] = PyObject_Str,
+ [FVC_REPR] = PyObject_Repr,
+ [FVC_ASCII] = PyObject_ASCII
+};
+
#define UNBOUNDLOCAL_ERROR_MSG \
"cannot access local variable '%s' where it is not associated with a value"
#define UNBOUNDFREE_ERROR_MSG \