From 0a84765ba955fdc5bd78d11beab63fbf0751257b Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 18 Jun 2020 18:25:16 -0400 Subject: [PATCH] MNT: migrate away from deprecated c-api The new macros were added in py33 so all versions of Python we support have them. closes #17629 --- src/ft2font_wrapper.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp index 102cfbda3dac..98e9ff74f77a 100644 --- a/src/ft2font_wrapper.cpp +++ b/src/ft2font_wrapper.cpp @@ -635,11 +635,10 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k size_t size; if (PyUnicode_Check(textobj)) { - size = PyUnicode_GET_SIZE(textobj); + size = PyUnicode_GET_LENGTH(textobj); codepoints.resize(size); - Py_UNICODE *unistr = PyUnicode_AsUnicode(textobj); for (size_t i = 0; i < size; ++i) { - codepoints[i] = unistr[i]; + codepoints[i] = PyUnicode_ReadChar(textobj, i); } } else if (PyBytes_Check(textobj)) { size = PyBytes_Size(textobj);