8000 MNT: migrate away from deprecated c-api · matplotlib/matplotlib@0a84765 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a84765

Browse files
committed
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
1 parent faffaa1 commit 0a84765

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)
0