8000 MAINT: refactor PyArrayMultiIterObject constructors by mattip · Pull Request #13445 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MAINT: refactor PyArrayMultiIterObject constructors #13445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2019

Conversation

mattip
Copy link
Member
@mattip mattip commented May 1, 2019

Creates a single private implementation of the PyArrayMultiIterObject
constructor, and calls it from the three existing public constructors.

Rebased #7441 off master and made a new PR since I could not push the rebase to @jaimefrio 's repo. Of course we only need one of these, @jaimefrio if you wish to move forward on it feel free to close this one.

Copy link
Member
@seberg seberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr: Makes the C-Api a bit more general, but it is a super corner case and seems OK, and not branching is much nicer.

It seems to me that the C-API functions PyArray_MultiIterNew and PyArray_MultiIterFromObjects previously only accepted arrays, while the Py-API also accepted iterator objects. The whole thing seems a bit strange to me, but on the other hand, it seems also harmless to generalize (and we could deprecate it at some point if we want to). It seem impossible that someone relies on MultiIterObjects getting broadcast when using the C-API. Those are two very very unlikely things together.

@eric-wieser eric-wieser changed the title MANT: refactor PyArrayMultiIterObject constructors MAINT: refactor PyArrayMultiIterObject constructors May 2, 2019
@mattip mattip force-pushed the multiiter_refactor branch from 1957874 to 825b767 Compare May 12, 2019 21:53
@mattip
Copy link
Member Author
mattip commented May 12, 2019

Updated with all requested changes, including using PySequence_Fast

@mattip mattip requested a review from seberg May 16, 2019 04:07
Copy link
Member
@seberg seberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, looks good to me. Could you not squash it right away next time maybe? Makes looking at followup changes a bit easier (not sure it would have helped here).

There is a merge conflict unfortunately.

@seberg seberg force-pushed the multiiter_refactor branch from 825b767 to 4f389dd Compare May 21, 2019 20:38
@seberg
Copy link
Member
seberg commented May 21, 2019

Forced pushed a hopefully good rebase (it was unfortunate I/we merged the other one first), undos some of the error message changes, but I do not think that matters. But it may need at least one more glance through now unfortunately.

Creates a single private implementation of the PyArrayMultiIterObject
constructor, and calls it from the three existing public constructors.
@seberg seberg force-pushed the multiiter_refactor branch from 4f389dd to 17abad6 Compare May 21, 2019 20:43
@seberg seberg self-requested a review May 21, 2019 22:34
@mattip
Copy link
Member Author
mattip commented May 28, 2019

@seberg ping

Copy link
Member
@seberg seberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, this undid the mnore detailed error messages now, but that higher detail did not give much anyway (negative number is implausible, so I think it is OK to not distinguish the two).

Cannot see anything wrong or any merge issue that arose. Matti, go ahead and merge just in case you wanted to have a glance because of the merge. Otherwise I will merge in a day or so.

@seberg seberg self-assigned this May 28, 2019
@mattip mattip merged commit f90270b into numpy:master May 29, 2019
@mattip mattip deleted the multiiter_refactor branch May 29, 2019 05:16
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.

4 participants
0