Skip to content

Warnings need different stacklevel after NEP 18 overrides #13329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rgommers opened this issue Apr 14, 2019 · 1 comment · Fixed by #13589
Closed

Warnings need different stacklevel after NEP 18 overrides #13329

rgommers opened this issue Apr 14, 2019 · 1 comment · Fixed by #13589

Comments

@rgommers
Copy link
Member

An example can be seen in recent doc builds:

/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/core/overrides.py:150: RankWarning: Polyfit may be poorly conditioned
  implementation, public_api, relevant_args, args, kwargs)
/home/circleci/repo/venv/lib/python3.6/site-packages/numpy/core/overrides.py:150: RankWarning: Polyfit may be poorly conditioned
  implementation, public_api, relevant_args, args, kwargs)

In every function that got an override, the warnings stacklevel needs to be increased by 1.

I looked for an existing issue for this but couldn't find it. @shoyer does this need to be added to the NEP 18 tracking issue?

@shoyer
Copy link
Member

shoyer commented Apr 14, 2019 via email

shoyer added a commit to shoyer/numpy that referenced this issue May 19, 2019
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 numpyGH-13329
shoyer added a commit that referenced this issue May 20, 2019
#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants