diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-09-02 10:06:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-02 10:06:54 -0500 |
commit | 3dbbfd8db5c21c603620bebc98e03bc84334f11c (patch) | |
tree | e29eb26cfbf72ee9b03aa15dd02671bf17e70301 /numpy/ma/core.py | |
parent | 9164f23c19c049e28d4d4825a53bbb01aedabcfc (diff) | |
parent | 68ea0c792db6bac435752e45d8681f7f1283453d (diff) | |
download | numpy-3dbbfd8db5c21c603620bebc98e03bc84334f11c.tar.gz |
Merge pull request #7148 from seberg/stacklevel+tests
ENH,TST: Bump stacklevel and add tests for warnings
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r-- | numpy/ma/core.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index b1e48c156..1bf41b3d8 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3210,7 +3210,8 @@ class MaskedArray(ndarray): "of fill_value at 0. Discarding " "heterogeneous fill_value and setting " "all to {fv!s}.".format(indx=indx, - fv=dout._fill_value[0])) + fv=dout._fill_value[0]), + stacklevel=2) dout._fill_value = dout._fill_value.flat[0] dout._isfield = True # Update the mask if needed @@ -4195,7 +4196,7 @@ class MaskedArray(ndarray): raise TypeError("Only length-1 arrays can be converted " "to Python scalars") elif self._mask: - warnings.warn("Warning: converting a masked element to nan.") + warnings.warn("Warning: converting a masked element to nan.", stacklevel=2) return np.nan return float(self.item()) @@ -6909,7 +6910,7 @@ def rank(obj): # 2015-04-12, 1.10.0 warnings.warn( "`rank` is deprecated; use the `ndim` function instead. ", - np.VisibleDeprecationWarning) + np.VisibleDeprecationWarning, stacklevel=2) return np.ndim(getdata(obj)) rank.__doc__ = np.rank.__doc__ |