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

Skip to content

Commit 91229f1

Browse files
authored
Merge pull request #17680 from tacaswell/mnt_remove_deprecated_c
MNT: migrate away from deprecated c-api
2 parents a56da39 + 0a84765 commit 91229f1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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)