Commit 86ebcfef authored by Christoph Groth's avatar Christoph Groth
Browse files

fixes for 32 bit machines

parent c46580c7
* Fix float hash on 32 bit machines
* Fix this: ta.array(np.matrix([1,2,3]))
* Implement missing arithmetic operations.
......
......@@ -396,8 +396,8 @@ Py_ssize_t index_from_key(int ndim, const size_t *shape, PyObject *key)
out_of_range:
PyErr_Format(PyExc_IndexError, "Index %ld out of range "
"(-%ld <= index < %ld) in dimension %d.",
indices[d], s, s, d);
"(-%lu <= index < %lu) in dimension %d.",
indices[d], (unsigned long)s, (unsigned long)s, d);
return -1;
}
......
......@@ -44,11 +44,13 @@ PyObject *filled_pyargs(PyObject *args, int value)
if (!PyArg_ParseTuple(args, "O|O&", &pyshape, dtype_converter, &dtype))
return 0;
size_t shape[max_ndim];
int ndim = load_index_seq_as_ulong(
pyshape, shape, max_ndim, "Negative dimensions are not allowed.");
unsigned long shape_as_ulong[max_ndim];
int ndim = load_index_seq_as_ulong(pyshape, shape_as_ulong, max_ndim,
"Negative dimensions are not allowed.");
if (ndim == -1) return 0;
size_t shape[max_ndim];
for (int d = 0; d < ndim; ++d) shape[d] = shape_as_ulong[d];
return filled_dtable[int(dtype)](ndim, shape, value);
}
......
......@@ -186,15 +186,15 @@ def test_as_dict_key():
def test_hash_equality():
for tup in [0, -1, -1.0, -1 + 0j, -0.3, 1.7, 0.4j,
for thing in [0, -1, -1.0, -1 + 0j, -0.3, 1.7, 0.4j,
-12.3j, 1 - 12.3j, 1.3 - 12.3j,
(), (-1,), (2,),
(0, 0), (-1, -1), (-5, 7), (3, -1, 0),
((0, 0), (0, 0)), (((-1,),),)]:
arr = ta.array(tup)
assert arr == tup
assert not (arr != tup)
assert hash(arr) == hash(tup)
arr = ta.array(thing)
assert arr == thing
assert not (arr != thing)
assert hash(arr) == hash(thing)
def test_broadcasting():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment