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

Skip to content

Commit 393a101

Browse files
authored
Merge pull request #17692 from meeseeksmachine/auto-backport-of-pr-17680-on-v3.3.x
Backport PR #17680 on branch v3.3.x (MNT: migrate away from deprecated c-api)
2 parents 060dd59 + 50da689 commit 393a101

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)