Commit 06c02d31 authored by Mark Florisson's avatar Mark Florisson

py23 compat

parent 09e33cb2
......@@ -346,7 +346,7 @@ cdef class array:
self.len = stride * self.itemsize
elif mode == "c":
idx = self.ndim-1; stride = itemsize
for dim in reversed(shape):
for dim in shape[::-1]:
self.strides[idx] = stride
int_dim = <Py_ssize_t>dim
stride = stride * int_dim
......
......@@ -567,20 +567,26 @@ def get_axes_specs(env, axes):
return axes_specs
def all(it):
for item in it:
if not item:
return False
return True
def is_cf_contig(specs):
is_c_contig = is_f_contig = False
if (len(specs) == 1 and specs == [('direct', 'contig')]):
is_c_contig = True
elif (specs[-1] == ('direct','contig') and
all(axis == ('direct','follow') for axis in specs[:-1])):
elif (specs[-1] == ('direct','contig') and
all([axis == ('direct','follow') for axis in specs[:-1]])):
# c_contiguous: 'follow', 'follow', ..., 'follow', 'contig'
is_c_contig = True
elif (len(specs) > 1 and
specs[0] == ('direct','contig') and
all(axis == ('direct','follow') for axis in specs[1:])):
specs[0] == ('direct','contig') and
all([axis == ('direct','follow') for axis in specs[1:]])):
# f_contiguous: 'contig', 'follow', 'follow', ..., 'follow'
is_f_contig = True
......
......@@ -578,9 +578,6 @@ class PyObjectType(PyrexType):
else:
return cname
def invalid_value(self):
return "1"
def global_init_code(self, entry, code):
code.put_init_var_to_py_none(entry, nanny=False)
......
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