Discussion:
[Numpy-discussion] [7949] How to handle these deprecation Warning errors
Saurabh Mehta
2016-09-26 13:36:08 UTC
Permalink
Hi

I am working on issue #7949, and need to use "-3" switch while running
python 2.7 for my tests.
python -3 -c "import numpy as np; np.test()"

Several errors are reported and all all of them are DeprecationWarnings,
which is ok. (https://travis-ci.org/njase/numpy/jobs/162733502)

*But now these errors must be either fixed or skipped. This is where I am
facing problem. Pls suggest:*

1. *Identify that python was invoked with -3 and skip these cases*:
There seems no way to know if python was invoked with -3
sys.argv only reports about "-c" and ignores other switches


2. *Fix these issues:* All of them are about deprecated APIs and new APIs
have been introduced in python 3. Since I am using python 2.x, I don't see
a way to fix them

What to do?

Regards
Saurabh
Sebastian Berg
2016-09-26 15:08:46 UTC
Permalink
Post by Saurabh Mehta
Hi
I am working on issue #7949, and need to use "-3" switch while
running python 2.7 for my tests.
python -3 -c "import numpy as np; np.test()"
Several errors are reported and all all of them are
DeprecationWarnings, which is ok. (https://travis-ci.org/njase/numpy/
jobs/162733502)
OK, most of them seem harmless (i.e. don't use the slice C-slot....).

I think we should just get rid of the slice C-slot thing globally, the
simplest way would be to go to numpy/testing/nosetester.py, look for
things like `sup.filter(message='Not importing directory')`. Then,
maybe specific `if sys.version_info.major == 2 and sys.py3kwarning`,
just add some `sup.filter` such as:

```
if sys.version_info.major == 2 and sys.py3kwarning:
    sup.filter(DeprecationWarning, message="in 3.x, __setslice__")
    sup.filter(DeprecationWarning, message="in 3.x, __getslice__")

```
First scrolling through the errors, my guess is that the other errors
we can also silence more locally.

This silencing might also leek to scipy, but frankly I am not worried
about it for those slots. The threading warnings seem also quite noisy
(and useless), but not sure right away what the best approach for that
would be.

- Sebastian
Post by Saurabh Mehta
But now these errors must be either fixed or skipped. This is where I
There seems no way to know if python was invoked with -3
sys.argv only reports about "-c" and ignores other switches
2. Fix these issues: All of them are about deprecated APIs and new
APIs have been introduced in python 3. Since I am using python 2.x, I
don't see a way to fix them
What to do?
Regards
Saurabh
_______________________________________________
NumPy-Discussion mailing list
https://mail.scipy.org/mailman/listinfo/numpy-discussion
Loading...