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
NumPy DeprecationWarning handled in strange way #11080
Comments
Yup, this is a result of having It's a bit messy and confusing, but it's never really been a big enough problem to be worth fixing. |
I got curious and went to see what it would take to fix it. We could quite easily leave the code out of all warnings attributed to Tracebacks and pdb find the file by doing: frame.f_code.co_filename Warnings finds the file by doing the equivalent of: frame.f_globals.get('__file__', sys.argv[0]) We give each input a unique fake filename for its code, so it can be looked up for tracebacks. But they all have to share the global namespace, so I don't think we can distinguish them for warnings at the moment. I've just commented about this on an ancient Python issue. |
A PR I submitted to Python was merged, so this should be fixed in Python 3.8. |
Thanks @takluyver! |
When performing an operation with NumPy 1.14 that appears to be deprecated, the warning seems to be tracking back to IPython or the IPython Kernel depending on context, which is a bit misleading. In the Jupyter Notebook, it adds a little extra text stating,
This is separate from the ipykernel package so we can avoid doing imports until
and trails off just like that (hence raising here first). Not sure if this is an issue in IPython, the IPython Kernel, or NumPy. Here is an MRE though.Example:
Environment:
The text was updated successfully, but these errors were encountered: