Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50da689

Browse files
WeatherGodmeeseeksmachine
authored andcommitted
Backport PR #17680: MNT: migrate away from deprecated c-api
1 parent 060dd59 commit 50da689

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/ft2font_wrapper.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,10 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k
635635
size_t size;
636636

637637
if (PyUnicode_Check(textobj)) {
638-
size = PyUnicode_GET_SIZE(textobj);
638+
size = PyUnicode_GET_LENGTH(textobj);
639639
codepoints.resize(size);
640-
Py_UNICODE *unistr = PyUnicode_AsUnicode(textobj);
641640
for (size_t i = 0; i < size; ++i) {
642-
codepoints[i] = unistr[i];
641+
codepoints[i] = PyUnicode_ReadChar(textobj, i);
643642
}
644643
} else if (PyBytes_Check(textobj)) {
645644
size = PyBytes_Size(textobj);

0 commit comments

Comments
 (0)