[7949] How to handle these deprecation Warning errors
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
On Mo, 2016-09-26 at 15:36 +0200, Saurabh Mehta wrote:
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
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
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Saurabh Mehta
-
Sebastian Berg