Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Wrap/PyArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,17 @@ Base.strides(x::PyArray{T,N,M,L,R}) where {T,N,M,L,R} =
error("strides are not a multiple of element size")
end

@static if isdefined(Base, :try_strides)
Base.try_strides(x::PyArray{T,N,M,L,T}) where {T,N,M,L} =
if all(mod.(x.strides, sizeof(T)) .== 0)
div.(x.strides, sizeof(T))
else
nothing
end
Base.is_ptr_loadable(x::PyArray{T,N,M,L,T}) where {T,N,M,L} = true
Base.is_ptr_storable(x::PyArray{T,N,M,L,T}) where {T,N,M,L} = Utils.ismutablearray(x)
end

function Base.showarg(io::IO, x::PyArray{T,N}, toplevel::Bool) where {T,N}
toplevel || print(io, "::")
print(io, "PyArray{")
Expand Down
Loading