[Numpy-discussion] python 3.8: heads up: numpy/ma/core.py causes warning that breaks numpy detection in boost build

balducci at units.it balducci at units.it
Fri Mar 1 05:23:23 EST 2019


hello

just a notice to help preventing future problems... 


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----


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



More information about the NumPy-Discussion mailing list