Thanks to visit codestin.com
Credit goes to github.com

Skip to content

missing invalid warning on nan comparisons? #11589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anntzer opened this issue Jul 18, 2018 · 4 comments · Fixed by #11595
Closed

missing invalid warning on nan comparisons? #11589

anntzer opened this issue Jul 18, 2018 · 4 comments · Fixed by #11595

Comments

@anntzer
Copy link
Contributor

anntzer commented Jul 18, 2018

Comparisons to nan appears to fail to trigger an invalid warning in some installs:

  • Running import numpy as np; np.seterr(invalid="raise"); np.minimum(np.nan, 1) (incorrectly) runs with no exception in a clean conda env with just python=3.6 and numpy=1.14.5 (on an Arch Linux system), or having pip-installed pypi's numpy 1.14.5 wheel with Arch Linux's system python (3.6).
  • Conversely, using Arch Linux's system python 3.6 with Arch Linux's python-numpy 1.14.5 package (https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/python-numpy, doesn't appear to have anything really weird to it), I do get a FloatingPointError thrown, as expected.

I'm a bit at loss of what could cause this discrepancy.

@charris
Copy link
Member

charris commented Jul 18, 2018

Can you try the 1.15.0 pre-release from pypi?

@anntzer
Copy link
Contributor Author

anntzer commented Jul 18, 2018

No error thrown likewise after pip install --user numpy==1.15.0rc2 (I did check that it's what ends up being imported).

@anntzer
Copy link
Contributor Author

anntzer commented Jul 19, 2018

I can also repro this from a clean docker image (the manylinux one):

$ sudo docker run -it quay.io/pypa/manylinux1_x86_64 bash
[root@ba61b696f550 /]# /opt/python/cp36-cp36m/bin/python -mvenv testenv
[root@ba61b696f550 /]# source testenv/bin/activate
(testenv) [root@ba61b696f550 /]# pip install numpy
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (12.2MB)
    100% |████████████████████████████████| 12.2MB 86kB/s 
Installing collected packages: numpy
Successfully installed numpy-1.14.5
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(testenv) [root@ba61b696f550 /]# python -c 'import numpy as np; np.seterr(invalid="raise"); np.minimum(np.nan, 1)'
# (no error)

@mattip
Copy link
Member

mattip commented Jul 20, 2018

The warning logic was incomplete. See PR #11595. Arch must be compiling with a flag that forces the code path that emits the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants