8000 Merge pull request #17984 from meeseeksmachine/auto-backport-of-pr-17… · matplotlib/matplotlib@8272171 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8272171

Browse files
authored
Merge pull request #17 8000 984 from meeseeksmachine/auto-backport-of-pr-17972-on-v3.3.x
Backport PR #17972 on branch v3.3.x (Fix PyPy compatiblity issue)
2 parents b9ca37f + db490ac commit 8272171

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ft2font_wrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,16 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k
637637
if (PyUnicode_Check(textobj)) {
638638
size = PyUnicode_GET_LENGTH(textobj);
639639
codepoints.resize(size);
640+
#if defined(PYPY_VERSION) && (PYPY_VERSION_NUM < 0x07030200)
641+
Py_UNICODE *unistr = PyUnicode_AsUnicode(textobj);
642+
for (size_t i = 0; i < size; ++i) {
643+
codepoints[i] = unistr[i];
644+
}
645+
#else
640646
for (size_t i = 0; i < size; ++i) {
641647
codepoints[i] = PyUnicode_ReadChar(textobj, i);
642648
}
649+
#endif
643650
} else if (PyBytes_Check(textobj)) {
644651
size = PyBytes_Size(textobj);
645652
codepoints.resize(size);

0 commit comments

Comments
 (0)
0