def fill_zeros(result, x, y, name, fill):
if fill is None or is_float_dtype(result):<EOL><INDENT>return result<EOL><DEDENT>if name.startswith(('<STR_LIT:r>', '<STR_LIT>')):<EOL><INDENT>x, y = y, x<EOL><DEDENT>is_variable_type = (hasattr(y, '<STR_LIT>') or hasattr(y, '<STR_LIT:type>'))<EOL>is_scalar_type = is_scalar(y)<EOL>if not is_variable_type and not is_scalar_type:<EOL><INDENT>return result<EOL><DEDENT>if is_scalar_type:<EOL><INDENT>y = np.array(y)<EOL><DEDENT>if is_integer_dtype(y):<EOL><INDENT>if (y == <NUM_LIT:0>).any():<EOL><INDENT>mask = ((y == <NUM_LIT:0>) & ~np.isnan(result)).ravel()<EOL>shape = result.shape<EOL>result = result.astype('<STR_LIT>', copy=False).ravel()<EOL>np.putmask(result, mask, fill)<EOL>if np.isinf(fill):<EOL><INDENT>signs = y if name.startswith(('<STR_LIT:r>', '<STR_LIT>')) else x<EOL>signs = np.sign(signs.astype('<STR_LIT:float>', copy=False))<EOL>negative_inf_mask = (signs.ravel() < <NUM_LIT:0>) & mask<EOL>np.putmask(result, negative_inf_mask, -fill)<EOL><DEDENT>if "<STR_LIT>" in name:  <EOL><INDENT>nan_mask = ((y == <NUM_LIT:0>) & (x == <NUM_LIT:0>)).ravel()<EOL>np.putmask(result, nan_mask, np.nan)<EOL><DEDENT>result = result.reshape(shape)<EOL><DEDENT><DEDENT>return result<EOL>
If this is a reversed op, then flip x,y

If we have an integer value (or array in y)
and we have 0's, fill them with the fill,
return the result.

Mask the nan's from x.