diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2014-10-18 03:07:43 +0100 |
---|---|---|
committer | Nathaniel J. Smith <njs@pobox.com> | 2014-10-21 02:48:32 +0100 |
commit | 3205c89ad3090c26fef8fd060117ee468c1b6c97 (patch) | |
tree | 317823cae9fb44de2d21140501f19422d3dbd623 /numpy/doc/byteswapping.py | |
parent | 2f1e27610453f901e81cd892b2aa3b3a2ac30819 (diff) | |
download | numpy-3205c89ad3090c26fef8fd060117ee468c1b6c97.tar.gz |
BUG: copy inherited masks in MaskedArray.__array_finalize__
Previously, operations which created a new masked array from an old
masked array -- e.g., np.empty_like -- would tend to result in the new
and old arrays sharing the same .mask attribute. This leads to
horrible brokenness in which writes to one array affect the other. In
particular this was responsible for part of the brokenness that
@jenshnielsen reported in gh-5184 in which np.gradient on masked
arrays would modify the original array's mask.
This fixes the worst part of the issues addressed in gh-3404, though
there's still an argument that we ought to deprecate the mask-copying
behaviour entirely so that empty_like returns an array with an empty
mask. That can wait until we find someone who cares though.
I also applied a small speedup to np.gradient (avoiding one copy);
previously this inefficiency was masking (heh) some of the problems
with masked arrays, so removing it is both an optimization and makes
it easier to test that things are working now.
Diffstat (limited to 'numpy/doc/byteswapping.py')
0 files changed, 0 insertions, 0 deletions