Closed
Description
TL;DR: we should add _validate_fill_value
to the EA interface and define _can_hold_element
in terms of it.
ATM ExtensionBlock._can_hold_element
incorrectly always returns True. This needs to be an EA method that returns True if and only if self[0] = value
is allowed on a non-empty array.
This method can in turn to defined in terms of a more broadly useful _validate_fill_value
that we use DTA/TDA/PA/PandasArray/Categorical:
def _can_hold_element(self, value):
try:
self._validate_fill_value(value)
return True
except (ValueError, TypeError):
return False