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

Skip to content

Commit 9fa990d

Browse files
committed
In C extensions, use FutureWarning, not DeprecationWarning.
DeprecationWarnings are hidden by default (that's why MatplotlibDeprecationWarning inherits from UserWarning, not DeprecationWarning...) and throwing a MatplotlibDeprecationWarning from C code is too much of a pain to be worth it; also, CPython suggests using FutureWarning for this purpose as well. (https://docs.python.org/3/library/warnings.html#warning-categories)
1 parent 08008d5 commit 9fa990d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ft2font_wrapper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const char *PyFT2Image_as_str__doc__ =
109109

110110
static PyObject *PyFT2Image_as_str(PyFT2Image *self, PyObject *args, PyObject *kwds)
111111
{
112-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
112+
if (PyErr_WarnEx(PyExc_FutureWarning,
113113
"FT2Image.as_str is deprecated since Matplotlib 3.2 and "
114114
"will be removed in Matplotlib 3.4; convert the FT2Image "
115115
"to a NumPy array with np.asarray instead.",
@@ -129,7 +129,7 @@ const char *PyFT2Image_as_rgba_str__doc__ =
129129

130130
static PyObject *PyFT2Image_as_rgba_str(PyFT2Image *self, PyObject *args, PyObject *kwds)
131131
{
132-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
132+
if (PyErr_WarnEx(PyExc_FutureWarning,
133133
"FT2Image.as_rgba_str is deprecated since Matplotlib 3.2 and "
134134
"will be removed in Matplotlib 3.4; convert the FT2Image "
135135
"to a NumPy array with np.asarray instead.",
@@ -162,7 +162,7 @@ const char *PyFT2Image_as_array__doc__ =
162162

163163
static PyObject *PyFT2Image_as_array(PyFT2Image *self, PyObject *args, PyObject *kwds)
164164
{
165-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
165+
if (PyErr_WarnEx(PyExc_FutureWarning,
166166
"FT2Image.as_array is deprecated since Matplotlib 3.2 and "
167167
"will be removed in Matplotlib 3.4; convert the FT2Image "
168168
"to a NumPy array with np.asarray instead.",
@@ -175,7 +175,7 @@ static PyObject *PyFT2Image_as_array(PyFT2Image *self, PyObject *args, PyObject
175175

176176
static PyObject *PyFT2Image_get_width(PyFT2Image *self, PyObject *args, PyObject *kwds)
177177
{
178-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
178+
if (PyErr_WarnEx(PyExc_FutureWarning,
179179
"FT2Image.get_width is deprecated since Matplotlib 3.2 and "
180180
"will be removed in Matplotlib 3.4; convert the FT2Image "
181181
"to a NumPy array with np.asarray instead.",
@@ -187,7 +187,7 @@ static PyObject *PyFT2Image_get_width(PyFT2Image *self, PyObject *args, PyObject
187187

188188
static PyObject *PyFT2Image_get_height(PyFT2Image *self, PyObject *args, PyObject *kwds)
189189
{
190-
if (PyErr_WarnEx(PyExc_DeprecationWarning,
190+
if (PyErr_WarnEx(PyExc_FutureWarning,
191191
"FT2Image.get_height is deprecated since Matplotlib 3.2 and "
192192
"will be removed in Matplotlib 3.4; convert the FT2Image "
193193
"to a NumPy array with np.asarray instead.",

0 commit comments

Comments
 (0)