Skip to content

Commit 4f02c73

Browse files
committed
Merge pull request matplotlib#17684 from anntzer/unbytes
Deprecate passing bytes to FT2Font.set_text.
2 parents a2cf4f9 + d93b525 commit 4f02c73

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Passing `bytes` to ``FT2Font.set_text``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... is deprecated, pass `str` instead.

src/ft2font_wrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,13 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k
648648
}
649649
#endif
650650
} else if (PyBytes_Check(textobj)) {
651+
if (PyErr_WarnEx(
652+
PyExc_FutureWarning,
653+
"Passing bytes to FTFont.set_text is deprecated since Matplotlib "
654+
"3.4 and support will be removed in Matplotlib 3.6; pass str instead",
655+
1)) {
656+
return NULL;
657+
}
651658
size = PyBytes_Size(textobj);
652659
codepoints.resize(size);
653660
char *bytestr = PyBytes_AsString(textobj);

0 commit comments

Comments
 (0)