Skip to content

Commit 1076a16

Browse files
authored
Merge pull request #23594 from oscargus/ft2fontdeprecationremoval
Expire deprecation on passing bytes to FT2Font.set_text
2 parents ecab6de + f9df735 commit 1076a16

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Passing bytes to ``FT2Font.set_text``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is no longer supported. Pass str instead.

src/ft2font_wrapper.cpp

+1-15
Original file line numberDiff line numberDiff line change
@@ -596,22 +596,8 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k
596596
codepoints[i] = PyUnicode_ReadChar(textobj, i);
597597
}
598598
#endif
599-
} else if (PyBytes_Check(textobj)) {
600-
if (PyErr_WarnEx(
601-
PyExc_FutureWarning,
602-
"Passing bytes to FTFont.set_text is deprecated since Matplotlib "
603-
"3.4 and support will be removed in Matplotlib 3.6; pass str instead",
604-
1)) {
605-
return NULL;
606-
}
607-
size = PyBytes_Size(textobj);
608-
codepoints.resize(size);
609-
char *bytestr = PyBytes_AsString(textobj);
610-
for (size_t i = 0; i < size; ++i) {
611-
codepoints[i] = bytestr[i];
612-
}
613599
} else {
614-
PyErr_SetString(PyExc_TypeError, "String must be str or bytes");
600+
PyErr_SetString(PyExc_TypeError, "set_text requires str-input.");
615601
return NULL;
616602
}
617603

0 commit comments

Comments
 (0)