Skip to content

Commit aaefde4

Browse files
committed
WIP: add explicit test of conversion to float
1 parent ba91d7a commit aaefde4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎lib/matplotlib/axes/_base.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ def set_patchprops(self, fill_poly, **kwargs):
211211
fill_poly.set(**kwargs)
212212

213213
def _xy_from_xy(self, x, y):
214+
def _check_numeric(inp):
215+
if inp.dtype.kind not in set('biufc'):
216+
raise TypeError('input must be numeric after unit conversion')
217+
return inp
218+
214219
if self.axes.xaxis is not None and self.axes.yaxis is not None:
215220
bx = self.axes.xaxis.update_units(x)
216221
by = self.axes.yaxis.update_units(y)
@@ -221,8 +226,9 @@ def _xy_from_xy(self, x, y):
221226

222227
# like asanyarray, but converts scalar to array, and doesn't change
223228
# existing compatible sequences
224-
x = _check_1d(x)
225-
y = _check_1d(y)
229+
x = _check_numeric(_check_1d(x))
230+
y = _check_numeric(_check_1d(y))
231+
226232
if x.shape[0] != y.shape[0]:
227233
raise ValueError("x and y must have same first dimension, but "
228234
"have shapes {} and {}".format(x.shape, y.shape))

0 commit comments

Comments
 (0)