Commit 4c02adc9 authored by Stefan Behnel's avatar Stefan Behnel

Do not depend on the default type inference in "cpython/array.pxd".

parent 343262ae
...@@ -131,14 +131,14 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero): ...@@ -131,14 +131,14 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
""" fast creation of a new array, given a template array. """ fast creation of a new array, given a template array.
type will be same as template. type will be same as template.
if zero is true, new array will be initialized with zeroes.""" if zero is true, new array will be initialized with zeroes."""
op = newarrayobject(Py_TYPE(template), length, template.ob_descr) cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
if zero and op is not None: if zero and op is not None:
memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
return op return op
cdef inline array copy(array self): cdef inline array copy(array self):
""" make a copy of an array. """ """ make a copy of an array. """
op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
return op return op
......
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