Skip to content

array_multiply != the multiply ufunc #3503

Closed
@inducer

Description

@inducer

This issue is a continuation of the disussion with @seberg in #3501, along with #3502:

Lots of places (such as 1, 2) use PyArray_Type->tp_as_number->nb_multiply to call the multiply ufunc (etc.). Because of __array_priority__, the semantics of nb_multiply are no longer the same as the ufunc. Specifically, nb_multiply is required to to return NotImplemented in cases of priority inversion, whereas the ufunc has a job to do and just needs to do it, without asking questions about priorities.


EDIT (seberg): This is still the case and probably cause of a few bugs (I am very sure reading an issue recently). It shouldn't be hard to fix, we have the nb_ops or mapping that is used for the array object: That needs to used throughout for scalartypes.c.src and scalarmath.c.src would do so indirectly then, although directly might solve additional unnecessary dances.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions