Commit 4050613c authored by Dmitry Shesterkin's avatar Dmitry Shesterkin Committed by GitHub

Fixed initialization of the array with the list which was broken in GH-3244 (GH-3465)

parent 48dc1f01
...@@ -269,8 +269,11 @@ class PointerType(CythonType): ...@@ -269,8 +269,11 @@ class PointerType(CythonType):
class ArrayType(PointerType): class ArrayType(PointerType):
def __init__(self): def __init__(self, value=None):
self._items = [None] * self._n if value is None:
self._items = [None] * self._n
else:
super(ArrayType, self).__init__(value)
class StructType(CythonType): class StructType(CythonType):
......
...@@ -537,3 +537,14 @@ def none_declare(): ...@@ -537,3 +537,14 @@ def none_declare():
f = None f = None
f2 = cython.declare(Foo, f) f2 = cython.declare(Foo, f)
return f2 return f2
def array_init_with_list():
"""
>>> array_init_with_list()
[10, 42]
"""
x = cython.declare(cython.int[20], list(range(20)))
x[12] = 42
return [x[10], x[12]]
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