Repository: Suzhou-Tongyuan/jnumpy (language: python)

Issue:
update flags when converting ndarray to julia Array if copy happens
Should also update flags too

https://github.com/Suzhou-Tongyuan/jnumpy/blob/c426a0728c1f3b7c492a0fa5e2c4959acfdcecca/TyPython/src/CPython.NumPy.jl#L93-L100


Discussion / hints:

Fix patch:
diff --git a/TyPython/src/CPython.NumPy.jl b/TyPython/src/CPython.NumPy.jl
index 5fe8e43..7dbe388 100644
--- a/TyPython/src/CPython.NumPy.jl
+++ b/TyPython/src/CPython.NumPy.jl
@@ -97,6 +97,7 @@ function from_ndarray(x::Py)
         __array_struct__ = x.__array_struct__
         ptr = C.Ptr{PyArrayInterface}(_get_capsule_ptr(__array_struct__))
         info = ptr[] :: PyArrayInterface
+        flags = info.flags
     end
 
     # TODO: exception check


Test patch:
diff --git a/TyPython/test/convert.jl b/TyPython/test/convert.jl
index 712698c..4f91e1c 100644
--- a/TyPython/test/convert.jl
+++ b/TyPython/test/convert.jl
@@ -180,6 +180,9 @@ end
         @test py_cast(Float64, py_x_sub[py_cast(Py, (0,0))]) == x_sub[1, 1]
         @test !py_cast(Bool, py_x_sub.flags.c_contiguous)
         @test !py_cast(Bool, py_x_sub.flags.f_contiguous)
+        x_sub_copy = py_cast(AbstractArray, py_x_sub)
+        @test x_sub_copy isa Array
+        @test pointer(x_sub_copy) != pointer(x_sub)
         x_re = reinterpret(ComplexF64, x)
         py_x_re = py_cast(Py, x_re)
         @test py_cast(Tuple{Int, Int}, py_x_re.shape) == (2, 4)