Suzhou-Tongyuan / jnumpy

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

Check the element type when casting julia array to python #50

Closed songjhaha closed 2 years ago

songjhaha commented 2 years ago

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

actually only AbstractArray{<:Number} could success, so:

function py_cast(::Type{Py}, o::T) where {T <: AbstractArray{<:Number}}
 ...
end