Skip to content

array_equal Illegal instruction #9534

@doubleycn

Description

@doubleycn

numpy version:

[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.14.0.dev0+9e05bc3'

python3 a.py
output:

aaa <class 'numpy.ndarray'> <class 'numpy.ndarray'>
Illegal instruction

cat a.py

import numpy as np
a=[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1]
b=[0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1]
np.array_equal(a,b)

array_equal function at numeric.py

    try:
        a1, a2 = asarray(a1), asarray(a2)
    except Exception:
        return False
    if a1.shape != a2.shape:
        return False
    print('aaa', type(a1), type(a2))
    print(a1 == a2, "bbb")
    return bool(asarray(a1 == a2).all())

why a1 == a2 have core dump.

the numpy version is 1.13. i try it. have same error.

this example is right:

[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.array_equal([1, 2], [1, 2])
aaa <class 'numpy.ndarray'> <class 'numpy.ndarray'>
[ True  True] bbb
True

python2 run same code is right.

Python 2.7.5 (default, Nov  6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.7.1'
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions