Skip to content

BUG: Relax dtype identity check in reductions#20757

Merged
charris merged 2 commits intonumpy:maintenance/1.22.xfrom
charris:backport-20729-20754
Jan 7, 2022
Merged

BUG: Relax dtype identity check in reductions#20757
charris merged 2 commits intonumpy:maintenance/1.22.xfrom
charris:backport-20729-20754

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented Jan 6, 2022

Backport of #20729 and #20754.

In some cases, e.g. ensure-native-byte-order will return not the
default, but a copy of the descriptor.

This (and maybe metadata) makes it somewhat annoying to ensure
exact identity between descriptors for reduce "operands" as
returned by the resolve-descirptors method of the ArrayMethod.

To avoid this problem, we check for no-casting (which implies
viewable with offset == 0) rather than strict identity.

Unfortunately, this means that descriptor resolution must be slightly
more careful, but in general this should all be perfectly well
defined.

Closes gh-20699. Closes gh-20751.

In some cases, e.g. ensure-native-byte-order will return not the
default, but a copy of the descriptor.

This (and maybe metadata) makes it somewhat annoying to ensure
exact identity between descriptors for reduce "operands" as
returned by the resolve-descirptors method of the ArrayMethod.

To avoid this problem, we check for no-casting (which implies
viewable with `offset == 0`) rather than strict identity.

Unfortunately, this means that descriptor resolution must be slightly
more careful, but in general this should all be perfectly well
defined.

Closes numpygh-20699
@charris charris added this to the 1.22.1 release milestone Jan 6, 2022
This closes numpygh-20751, which was due to the assert not being noticed
triggered (not sure why) during initial CI run.
The behaviour is relaxed, so the assert must also be relaxed.
@charris charris force-pushed the backport-20729-20754 branch from c9c50ba to 5163ab6 Compare January 6, 2022 21:50
@charris charris merged commit 6b6605f into numpy:maintenance/1.22.x Jan 7, 2022
@charris charris deleted the backport-20729-20754 branch January 7, 2022 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants