Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions distributed/protocol/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,11 @@ def deserialize_numpy_maskedarray(header, frames):
if pickled_fv:
fill_value = pickle.loads(fill_value)

# Ensure fill_value is compatible with dtype
if fill_value is not None:
try:
fill_value = np.array(fill_value, dtype=data.dtype).item()
except (OverflowError, ValueError, TypeError):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your opening post mentions only TypeError. What are the use cases for OverflowError and ValueError?

fill_value = np.ma.default_fill_value(data.dtype)

return np.ma.masked_array(data, mask=mask, fill_value=fill_value)
Loading