Skip to content

Commit a5ac8a6

Browse files
committed
Put in fix from @mhvk to avoid repeated array finalization
1 parent 57f3967 commit a5ac8a6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

astropy/table/column.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,8 @@ def _copy_attrs(self, obj):
710710

711711
for attr in ('name', 'unit', 'format', 'description'):
712712
val = getattr(obj, attr, None)
713-
if attr == 'format':
714-
print('HERE in _copy_attrs():', type(obj), id(obj), val)
713+
# if attr == 'format':
714+
# print('HERE in _copy_attrs():', type(obj), id(obj), val)
715715
# if val is not None:
716716
# print('Setting {} = {}'.format(attr, val))
717717
setattr(self, attr, val)
@@ -1177,10 +1177,16 @@ def fill_value(self, val):
11771177

11781178
@property
11791179
def data(self):
1180-
out = self.view(ma.MaskedArray)
1181-
# The following is necessary because of a bug in Numpy, which was
1182-
# fixed in numpy/numpy#2703. The fix should be included in Numpy 1.8.0.
1183-
out.fill_value = self.fill_value
1180+
baseclass = self._baseclass
1181+
try:
1182+
self._baseclass = np.ndarray
1183+
out = self.view(ma.MaskedArray)
1184+
finally:
1185+
self._baseclass = baseclass
1186+
# out = self.view(ma.MaskedArray)
1187+
# # The following is necessary because of a bug in Numpy, which was
1188+
# # fixed in numpy/numpy#2703. The fix should be included in Numpy 1.8.0.
1189+
# out.fill_value = self.fill_value
11841190
return out
11851191

11861192
def filled(self, fill_value=None):

0 commit comments

Comments
 (0)