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/linalg/linalg.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/linalg/linalg.py')
-rw-r--r-- | numpy/linalg/linalg.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 0aa8d5ca9..27ec62403 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -890,12 +890,12 @@ def qr(a, mode='reduced'): msg = "".join(( "The 'full' option is deprecated in favor of 'reduced'.\n", "For backward compatibility let mode default.")) - warnings.warn(msg, DeprecationWarning, stacklevel=2) + warnings.warn(msg, DeprecationWarning, stacklevel=3) mode = 'reduced' elif mode in ('e', 'economic'): # 2013-04-01, 1.8 msg = "The 'economic' option is deprecated." - warnings.warn(msg, DeprecationWarning, stacklevel=2) + warnings.warn(msg, DeprecationWarning, stacklevel=3) mode = 'economic' else: raise ValueError("Unrecognized mode '%s'" % mode) @@ -2245,7 +2245,7 @@ def lstsq(a, b, rcond="warn"): "To use the future default and silence this warning " "we advise to pass `rcond=None`, to keep using the old, " "explicitly pass `rcond=-1`.", - FutureWarning, stacklevel=2) + FutureWarning, stacklevel=3) rcond = -1 if rcond is None: rcond = finfo(t).eps * max(n, m) |