Suzhou-Tongyuan / jnumpy

Writing Python C extensions in Julia within 5 minutes.
MIT License
234 stars 8 forks source link

should we support Base.ReinterpretArray when casting Julia arrays to Python? #49

Closed thautwarm closed 2 years ago

thautwarm commented 2 years ago

https://github.com/Suzhou-Tongyuan/jnumpy/blob/65cea6cc6a750911ab2c1545d94af26008e7b240/TyPython/src/CPython.Julia.jl#L80

songjhaha commented 2 years ago

I think it's fine when x is a Base.ReinterpretArray and StrideArray. Also need to check the type of parent(x), make sure it's a Array would be good.

songjhaha commented 2 years ago

For now, we support no-copy casting of ReinterpretArray when the condition below is true:

https://github.com/Suzhou-Tongyuan/jnumpy/blob/1d7e2007abb10fcc29cb4efb0e190c4829bd40f6/TyPython/src/CPython.Julia.jl#L80