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

py23 compat

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