summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2016-08-06 23:15:40 +0300
committermattip <matti.picus@gmail.com>2016-08-15 19:46:41 +0300
commit76eff9ca4648e96ba1f560e83f40383f68805493 (patch)
treefd6fb98bd46416ed561ecbf3c39b9c44cf2bce18 /numpy/ma/core.py
parent0fc9e4520b1d00b58a77f28936da2fec2672de83 (diff)
downloadnumpy-76eff9ca4648e96ba1f560e83f40383f68805493.tar.gz
ENH: skip or avoid gc/objectmodel differences btwn pypy and cpython
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 37836a0a0..b01656ec9 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -3279,12 +3279,13 @@ class MaskedArray(ndarray):
# We want to remove the unshare logic from this place in the
# future. Note that _sharedmask has lots of false positives.
if not self._isfield:
+ notthree = getattr(sys, 'getrefcount', False) and (sys.getrefcount(_mask) != 3)
if self._sharedmask and not (
# If no one else holds a reference (we have two
# references (_mask and self._mask) -- add one for
# getrefcount) and the array owns its own data
# copying the mask should do nothing.
- (sys.getrefcount(_mask) == 3) and _mask.flags.owndata):
+ (not notthree) and _mask.flags.owndata):
# 2016.01.15 -- v1.11.0
warnings.warn(
"setting an item on a masked array which has a shared "