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

Fix integer overflow in np.product #2697

Merged
merged 1 commit into from Jul 17, 2014
Merged

Fix integer overflow in np.product #2697

merged 1 commit into from Jul 17, 2014

Conversation

cgohlke
Copy link
Contributor

@cgohlke cgohlke commented Jul 6, 2014

On win-amd64-py3.x, test_convolve_fft.test_big_fail fails to raise a ValueError due to an integer overflow in np.product.
The following code raises a RuntimeWarning and allocates huge amounts of RAM:

import numpy as np
from astropy. convolution import convolve_fft
arr = np.empty([512, 512, 512], dtype=np.complex)
convolve_fft(arr, arr)
X:\Python34\lib\site-packages\astropy\convolution\convolve.py:391: RuntimeWarning: overflow encountered in long_scalars
  array_size_B = np.product(arrayshape)*np.dtype(complex_dtype).itemsize

@embray
Copy link
Member

embray commented Jul 11, 2014

Is this in dev or a particular version of Astropy? I didn't find this in my Windows testing.

@cgohlke
Copy link
Contributor Author

cgohlke commented Jul 11, 2014

This is v0.4rc1 on win-amd64-py3.x.

@embray
Copy link
Member

embray commented Jul 11, 2014

@astrofrog -- like I said, all the tests passed for me on Windows but that doesn't mean there are no issues

@astrofrog astrofrog added this to the v0.4.1 milestone Jul 13, 2014
@astrofrog
Copy link
Member

@embray - shall we merge this anyway since it can't really cause any harm? Looks like this was submitted from the Github interface which means it's not easy to rebase, so we should add the changelog entry when merging.

@embray
Copy link
Member

embray commented Jul 16, 2014

Sounds fine.

astrofrog added a commit that referenced this pull request Jul 17, 2014
Fix integer overflow in np.product
@astrofrog astrofrog merged commit f9cfe9f into astropy:master Jul 17, 2014
astrofrog added a commit that referenced this pull request Aug 6, 2014
Fix integer overflow in np.product
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

3 participants