lots of warnings with python3
I tried running python2 -3 on some code, and found numpy produces a lot of warnings. Many like: python -3 -c 'import numpy' ... /usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py:928: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x But also: /usr/lib64/python2.7/site-packages/numpy/lib/shape_base.py:838: DeprecationWarning: classic int division n /= max(dim_in,1)
On Wed, Aug 28, 2013 at 4:32 PM, Neal Becker <ndbecker2@gmail.com> wrote:
I tried running python2 -3 on some code, and found numpy produces a lot of warnings.
Many like: python -3 -c 'import numpy' ... /usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py:928: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x
Looks like a bug... in 2.x you *must* define __hash__ if you define __eq__, even if it's just as: def __hash__(self): return NotImplemented
But also: /usr/lib64/python2.7/site-packages/numpy/lib/shape_base.py:838: DeprecationWarning: classic int division n /= max(dim_in,1)
Also looks like a bug, should be //=. Want to file bugs/PRs? -n
On Wed, Aug 28, 2013 at 9:32 AM, Neal Becker <ndbecker2@gmail.com> wrote:
I tried running python2 -3 on some code, and found numpy produces a lot of warnings.
Many like: python -3 -c 'import numpy' ... /usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py:928: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x
But also: /usr/lib64/python2.7/site-packages/numpy/lib/shape_base.py:838: DeprecationWarning: classic int division n /= max(dim_in,1)
Some of these are bogus. ``` DeprecationWarning: CObject type is not supported in 3.x. Please use capsule objects instead. ``` Capsule objects aren't available in 2.6 and we don't use them for any of the 2.x Python series, only for 3.x. The `__hash__` being blocked hasn't seemed to be a problem, but we should probably fix it anyway. Chuck
On Wed, Aug 28, 2013 at 10:03 AM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Wed, Aug 28, 2013 at 9:32 AM, Neal Becker <ndbecker2@gmail.com> wrote:
I tried running python2 -3 on some code, and found numpy produces a lot of warnings.
Many like: python -3 -c 'import numpy' ... /usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py:928: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x
But also: /usr/lib64/python2.7/site-packages/numpy/lib/shape_base.py:838: DeprecationWarning: classic int division n /= max(dim_in,1)
For the rest, defining `__hash__ = None` should work, at least for the numpy.polynomial classes, as they aren't immutable. Chuck
On Wed, Aug 28, 2013 at 11:36 AM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Wed, Aug 28, 2013 at 10:03 AM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Wed, Aug 28, 2013 at 9:32 AM, Neal Becker <ndbecker2@gmail.com> wrote:
I tried running python2 -3 on some code, and found numpy produces a lot of warnings.
Many like: python -3 -c 'import numpy' ... /usr/lib64/python2.7/site-packages/numpy/lib/polynomial.py:928: DeprecationWarning: Overriding __eq__ blocks inheritance of __hash__ in 3.x
But also: /usr/lib64/python2.7/site-packages/numpy/lib/shape_base.py:838: DeprecationWarning: classic int division n /= max(dim_in,1)
For the rest, defining `__hash__ = None` should work, at least for the numpy.polynomial classes, as they aren't immutable.
See https://github.com/numpy/numpy/pull/3657 Chuck
participants (3)
-
Charles R Harris -
Nathaniel Smith -
Neal Becker