From 42337a0ca0923ce9cf7492c6d847a945a69ad7a6 Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Sun, 14 Jul 2024 13:02:43 +0100 Subject: [PATCH] [mypyc] Don't use _PyUnicode_FastCopyCharacters on 3.13 (#17524) Work on mypyc/mypyc#1056. --- mypyc/lib-rt/str_ops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mypyc/lib-rt/str_ops.c b/mypyc/lib-rt/str_ops.c index 90b19001f8f0..4ba181bcce85 100644 --- a/mypyc/lib-rt/str_ops.c +++ b/mypyc/lib-rt/str_ops.c @@ -117,7 +117,11 @@ PyObject *CPyStr_Build(Py_ssize_t len, ...) { PyObject *item = va_arg(args, PyObject *); Py_ssize_t itemlen = PyUnicode_GET_LENGTH(item); if (itemlen != 0) { +#if CPY_3_13_FEATURES + PyUnicode_CopyCharacters(res, res_offset, item, 0, itemlen); +#else _PyUnicode_FastCopyCharacters(res, res_offset, item, 0, itemlen); +#endif res_offset += itemlen; } }