python-astropy/python-astropy-bug2171.patch
2014-05-22 10:32:16 +02:00

36 lines
1.6 KiB
Diff

diff -ur astropy-0.3.2/astropy/io/fits/hdu/base.py astropy-0.3.2.checksum/astropy/io/fits/hdu/base.py
--- astropy-0.3.2/astropy/io/fits/hdu/base.py 2014-05-19 15:50:15.540882206 +0200
+++ astropy-0.3.2.checksum/astropy/io/fits/hdu/base.py 2014-05-19 15:51:32.084487630 +0200
@@ -1581,8 +1581,8 @@
hi = sum32 >> u16
lo = sum32 & uFFFF
- hi += np.add.reduce(bytes[0::2])
- lo += np.add.reduce(bytes[1::2])
+ hi += np.add.reduce(bytes[0::2], dtype=np.uint64)
+ lo += np.add.reduce(bytes[1::2], dtype=np.uint64)
if (bytes.nbytes // 2) % 2:
lo += last << u8
diff -ur astropy-0.3.2/astropy/io/fits/tests/test_checksum.py astropy-0.3.2.checksum/astropy/io/fits/tests/test_checksum.py
--- astropy-0.3.2/astropy/io/fits/tests/test_checksum.py 2014-05-19 15:50:15.549882277 +0200
+++ astropy-0.3.2.checksum/astropy/io/fits/tests/test_checksum.py 2014-05-19 15:52:39.844024043 +0200
@@ -42,7 +42,7 @@
hdul.close()
def test_image_create(self):
- n = np.arange(100)
+ n = np.arange(100, dtype=np.int64)
hdu = fits.PrimaryHDU(n)
hdu.writeto(self.temp('tmp.fits'), clobber=True, checksum=True)
with fits.open(self.temp('tmp.fits'), checksum=True) as hdul:
@@ -57,7 +57,7 @@
assert hdul[0].header['DATASUM'] == '4950'
def test_nonstandard_checksum(self):
- hdu = fits.PrimaryHDU(np.arange(10.0 ** 6))
+ hdu = fits.PrimaryHDU(np.arange(10.0 ** 6, dtype=np.float64))
hdu.writeto(self.temp('tmp.fits'), clobber=True,
checksum='nonstandard')
del hdu