diff options
author | Stephan Hoyer <shoyer@gmail.com> | 2019-05-20 09:37:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-20 09:37:18 -0700 |
commit | f9c1502e7ace9b48f0256a77c560aae43763a1f2 (patch) | |
tree | 1b04f2a79f979f6039a794173560da7153093ac9 /numpy/core/fromnumeric.py | |
parent | bdd75dff0aa8b77be5784923befb6410fc2f4837 (diff) | |
download | numpy-f9c1502e7ace9b48f0256a77c560aae43763a1f2.tar.gz |
BUG: Increment stacklevel for warnings to account for NEP-18 overrides (#13589)
* Increment stacklevel for warnings to account for NEP-18 overrides
For NumPy functions that make use of `__array_function__`, the appropriate the
stack level for warnings should generally be increased by 1 to account for
the override function defined in numpy.core.overrides.
Fixes GH-13329
* Update numpy/lib/type_check.py
Co-Authored-By: Sebastian Berg <sebastian@sipsolutions.net>
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r-- | numpy/core/fromnumeric.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 58da8a54b..cbbee463a 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -2145,7 +2145,7 @@ def sum(a, axis=None, dtype=None, out=None, keepdims=np._NoValue, warnings.warn( "Calling np.sum(generator) is deprecated, and in the future will give a different result. " "Use np.sum(np.fromiter(generator)) or the python sum builtin instead.", - DeprecationWarning, stacklevel=2) + DeprecationWarning, stacklevel=3) res = _sum_(a) if out is not None: @@ -3569,5 +3569,5 @@ def rank(a): warnings.warn( "`rank` is deprecated; use the `ndim` attribute or function instead. " "To find the rank of a matrix see `numpy.linalg.matrix_rank`.", - VisibleDeprecationWarning, stacklevel=2) + VisibleDeprecationWarning, stacklevel=3) return ndim(a) |