Skip to content
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

BUG: diagflat could overflow on windows or 32-bit platforms #18459

Merged
merged 1 commit into from Feb 22, 2021

Conversation

charris
Copy link
Member

@charris charris commented Feb 21, 2021

Backport of #18455.

Closes #18449.

For particularly large input arrays the np.diagflat function could yield non-zero diagonal elements due to integer overflow,
the latter facilitated by the default np.arange integer-dtype being np.int32 on windows.

This PR fixes aforementioned issue by explicitly setting the dtype to np.intp.

@charris charris added this to the 1.20.2 release milestone Feb 21, 2021
@charris charris changed the title BUG: Fixed an issue where diagflat could overflow on windows or 32-bit platforms BUG: diagflat could overflow on windows or 32-bit platforms Feb 21, 2021
@charris charris merged commit 6de68a4 into numpy:maintenance/1.20.x Feb 22, 2021
@charris charris deleted the backport-18455 branch May 3, 2021 17:31
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.

None yet

1 participant