• Kirill Smelkov's avatar
    kpi: Robustify logic in _newscalar · 6d2694d8
    Kirill Smelkov authored
    _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.
    6d2694d8
kpi.py 36.3 KB