summaryrefslogtreecommitdiff
path: root/numpy/core/_methods.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2016-01-23 15:58:58 +0100
committerSebastian Berg <sebastian@sipsolutions.net>2016-09-02 16:39:17 +0200
commit7884a8c9f5f5c6657413dbeaa59ad969280d38ea (patch)
tree91b55f723315291bf2605bb42aef809a65ff1d85 /numpy/core/_methods.py
parent9164f23c19c049e28d4d4825a53bbb01aedabcfc (diff)
downloadnumpy-7884a8c9f5f5c6657413dbeaa59ad969280d38ea.tar.gz
ENH: Add stacklevel to all (or almost all) our function calls
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r--numpy/core/_methods.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py
index 5fc2bc445..54e267541 100644
--- a/numpy/core/_methods.py
+++ b/numpy/core/_methods.py
@@ -56,7 +56,7 @@ def _mean(a, axis=None, dtype=None, out=None, keepdims=False):
rcount = _count_reduce_items(arr, axis)
# Make this warning show up first
if rcount == 0:
- warnings.warn("Mean of empty slice.", RuntimeWarning)
+ warnings.warn("Mean of empty slice.", RuntimeWarning, stacklevel=2)
# Cast bool, unsigned int, and int to float64 by default
if dtype is None and issubclass(arr.dtype.type, (nt.integer, nt.bool_)):
@@ -79,7 +79,8 @@ def _var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False):
rcount = _count_reduce_items(arr, axis)
# Make this warning show up on top.
if ddof >= rcount:
- warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning)
+ warnings.warn("Degrees of freedom <= 0 for slice", RuntimeWarning,
+ stacklevel=2)
# Cast bool, unsigned int, and int to float64 by default
if dtype is None and issubclass(arr.dtype.type, (nt.integer, nt.bool_)):