[Numpy-discussion] [7949] How to handle these deprecation Warning errors

Sebastian Berg sebastian at sipsolutions.net
Mon Sep 26 11:08:46 EDT 2016


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 at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160926/c6f28962/attachment.sig>


More information about the NumPy-Discussion mailing list