From 9b40f61d2acf2abbce0659a6a381ce46b9853e30 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 13 Sep 2021 19:00:42 -0400 Subject: [PATCH] Backport PR #21051: set_dashes does not support offset=None anymore. --- lib/matplotlib/backend_bases.py | 6 ++---- src/py_converters.cpp | 22 +--------------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index f4934d3d10be..0b8b66307cc7 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -914,15 +914,13 @@ def set_dashes(self, dash_offset, dash_list): Parameters ---------- - dash_offset : float or None + dash_offset : float The offset (usually 0). dash_list : array-like or None - The on-off sequence as points. + The on-off sequence as points. None specifies a solid line. Notes ----- - ``(None, None)`` specifies a solid line. - See p. 107 of to PostScript `blue book`_ for more info. .. _blue book: https://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF diff --git a/src/py_converters.cpp b/src/py_converters.cpp index 3a703509535c..d2c53c553c48 100644 --- a/src/py_converters.cpp +++ b/src/py_converters.cpp @@ -212,33 +212,13 @@ int convert_dashes(PyObject *dashobj, void *dashesp) { Dashes *dashes = (Dashes *)dashesp; - if (dashobj == NULL && dashobj == Py_None) { - return 1; - } - - PyObject *dash_offset_obj = NULL; double dash_offset = 0.0; PyObject *dashes_seq = NULL; - if (!PyArg_ParseTuple(dashobj, "OO:dashes", &dash_offset_obj, &dashes_seq)) { + if (!PyArg_ParseTuple(dashobj, "dO:dashes", &dash_offset, &dashes_seq)) { return 0; } - if (dash_offset_obj != Py_None) { - dash_offset = PyFloat_AsDouble(dash_offset_obj); - if (PyErr_Occurred()) { - return 0; - } - } else { - if (PyErr_WarnEx(PyExc_FutureWarning, - "Passing the dash offset as None is deprecated since " - "Matplotlib 3.3 and will be removed in Matplotlib 3.5; " - "pass it as zero instead.", - 1)) { - return 0; - } - } - if (dashes_seq == Py_None) { return 1; }