Bug 817546

Summary: numpy - Incorrect axis handling
Product: [Fedora] Fedora Reporter: Martin Kyral <mkyral>
Component: numpyAssignee: Gwyn Ciesla <gwync>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 16CC: gwync, jspaleta, orion, rdieter, sochotni, tomspur
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-12 23:41:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Kyral 2012-04-30 13:17:17 UTC
Description of problem:
During testing nympy, I have discovered two flaws with axis handling on n-dimensional arrays:

a) if the axis value is negative and goes out or borders for the array, the error message shows value (given_axis+2) instead of given_axis

b) as of nympy 1.4.0, if axis>MAXDIMS, it shall be treated as invalid rather than as axis=None (which was the old behavior). However, the condition shall be (axis>=MAXDIMS) for the sake of the consistency

Version-Release number of selected component (if applicable):
numpy-1.6.1-2.fc16.x86_64

How reproducible:
Always



Steps to Reproduce:
1) create script max_dims.py:

#!/usr/bin/python
import sys
from numpy import *

arg = sys.argv[1]
if (arg == 'None'):
    ax = None
else:
    ax = int(arg)

x = array([[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15]])
m = x.max(axis=ax)
print m

2a) [mkyral@dhcp-27-230 BZ692959 ]$ ./max_dims.py -3
Traceback (most recent call last):                                                                                   
  File "./max_dims.py", line 32, in <module>                                                                         
    m = x.max(axis=ax)                                                                                               
ValueError: axis(=-1) out of bounds

2b) MAXDIMS is 32:
[mkyral@dhcp-27-230 ]$ ./max_dims.py 33
Traceback (most recent call last):
  File "./max_dims.py", line 32, in <module>
    m = x.max(axis=ax)
ValueError: axis(=33) out of bounds
[mkyral@dhcp-27-230 ]$ ./max_dims.py 32
15
[mkyral@dhcp-27-230 ]$ ./max_dims.py 31
Traceback (most recent call last):
  File "./max_dims.py", line 32, in <module>
    m = x.max(axis=ax)
ValueError: axis(=31) out of bounds
[mkyral@dhcp-27-230 ]$ ./max_dims.py None
15



Actual results:
a) ValueError: axis(=-1) out of bounds

b) [mkyral@dhcp-27-230 ]$ ./max_dims.py 32
15



Expected results:
a) ValueError: axis(=-3) out of bounds

b) [mkyral@dhcp-27-230 ]$ ./max_dims.py 32
Traceback (most recent call last):
  File "./max_dims.py", line 32, in <module>
    m = x.max(axis=ax)
ValueError: axis(=32) out of bounds



Additional info:

Comment 1 Fedora End Of Life 2013-01-16 14:49:53 UTC
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Orion Poplawski 2013-02-12 23:41:46 UTC
FWIW - On Fedora 18 I get:

$ python max_dims.py -3
Traceback (most recent call last):
  File "max_dims.py", line 12, in <module>
    m = x.max(axis=ax)
  File "/usr/lib64/python2.7/site-packages/numpy/core/_methods.py", line 10, in _amax
    out=out, keepdims=keepdims)
ValueError: 'axis' entry is out of bounds

$ python max_dims.py 32
Traceback (most recent call last):
  File "max_dims.py", line 12, in <module>
    m = x.max(axis=ax)
  File "/usr/lib64/python2.7/site-packages/numpy/core/_methods.py", line 10, in _amax
    out=out, keepdims=keepdims)
ValueError: 'axis' entry is out of bounds

numpy-1.7.0-0.5.rc1.gitc4c169c.fc19.x86_64

So it does appear to be fixed in recent versions.

Comment 3 Fedora End Of Life 2013-02-13 16:04:16 UTC
Fedora 16 changed to end-of-life (EOL) status on 2013-02-12. Fedora 16 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.