Skip to content

BUG: Always return views from structured_to_unstructured when possible - #13332

Merged
charris merged 1 commit into
numpy:masterfrom
eric-wieser:fix-subarray-unstructured
May 11, 2019
Merged

charris merged 1 commit into
numpy:masterfrom
eric-wieser:fix-subarray-unstructured

Conversation

@eric-wieser

Copy link
Copy Markdown
Member

Also applies to unstructured_to_structured

While producing correct results, the test added in this commit would previously make an unnecessary copy, causing the assertion to fail.
The cause was astype was being asked to convert from a subarray of shape (x, y) to one of (x*y,), which it cannot do without making a copy.

This changes the approach used to skip the step of flattening subarrays to 1d

@charris

charris commented Apr 16, 2019

Copy link
Copy Markdown
Member

I marked this as a backport candidate. Does that make sense?

@eric-wieser

eric-wieser commented Apr 16, 2019 •

Copy link
Copy Markdown
Member Author

Yeah, I think so. Let's get #11326 in first though, and then I'll rebase this to try and construct a history that lets us backport all the commits (trivially) at once.

I think we should try to fix some of the other problems in #13333 at the same time

@charris

charris commented Apr 17, 2019

Copy link
Copy Markdown
Member

Let's get #11326 in first though

Bad PR?

@eric-wieser

Copy link
Copy Markdown
Member Author

Whoops, #13334

@mattip

mattip commented Apr 29, 2019

Copy link
Copy Markdown
Member

#13334 has been merged. @ahaldane could you review this one?

Also applies to unstructured_to_structured

While producing correct resutls, the test added in this commit would previously make an unecessary copy, causing the assertion to fail.
The cause was `astype` was being asked to convert from a subarray of shape `(x, y)` to one of `(x*y,)`, which it cannot do without making a copy.

This changes the approach used to skip the step of flattening subarrays to 1d
@eric-wieser
eric-wieser force-pushed the fix-subarray-unstructured branch from 0aeaac0 to e6a7e05 Compare May 1, 2019 15:56
@charris
charris merged commit 3337865 into numpy:master May 11, 2019
@charris

charris commented May 11, 2019

Copy link
Copy Markdown
Member

Thanks Eric.

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.

3 participants