kpi: Robustify logic in _newscalar
_newscalar creates a scalar value of type typ with specified dtype. Inside it works via creating dtype that will have its .type = typ and that's how NumPy knows to instantiate scalars of such dtype via specified typ. But at the end _newscalar was checking only that .dtype of creatged scalar == original dtype, while we can insist that scalar.dtype _is_ the created dtype which itself should be == to originally passed dtype. No change in behaviour, only make the logic more robust and explicit.
Showing
Please register or sign in to comment