On Fri, Mar 1, 2019 at 11:24 AM <baldu...@units.it> wrote: > python-3.8.0 (alpha) emits the following warning on numpy/ma/core.py > (verified up to official 1.16.2): > > ----8<---- > /usr/python3/site_python3/lib64/numpy.egg/numpy/ma/core.py:4466: > SyntaxWarning: "is" with a literal. Did you mean "=="? > if self.shape is (): > /usr/python3/site_python3/lib64/numpy.egg/numpy/ma/core.py:4466: > SyntaxWarning: "is" with a literal. Did you mean "=="? > if self.shape is (): > /usr/python3/site_python3/lib64/numpy.egg/numpy/core/include > ---->8---- Hi,
I believe the warning is really helpful, testing for an empty tuple with `is` probably only works because of a CPython implementation detail (namely that the empty tuple is interned by the interpreter). In other words, this seems like a bug which is fixed by using == instead. Regards, AndrĂ¡s > > > In turn, this breaks boost's numpy detection, which is done with: > > ----8<---- > notice: [python-cfg] running command '/usr/python3/bin/python -c "import sys; > sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"' > ---->8---- > > and thus produces an unusable include path (containing the warning > message from python) > > The following: > > ----8<---- > *** numpy/ma/core.py.PYTHON_3_8_COMPAT Wed Feb 27 12:45:06 2019 > --- numpy/ma/core.py Wed Feb 27 12:45:06 2019 > *************** > *** 4463,4469 **** > if m is nomask: > # compare to _count_reduce_items in _methods.py > > ! if self.shape is (): > if axis not in (None, 0): > raise np.AxisError(axis=axis, ndim=self.ndim) > return 1 > --- 4463,4469 ---- > if m is nomask: > # compare to _count_reduce_items in _methods.py > > ! if self.shape == (): > if axis not in (None, 0): > raise np.AxisError(axis=axis, ndim=self.ndim) > return 1 > ---->8---- > > fixes everything for me > > thanks > ciao > -g > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion