Skip to content

Commit f026cfe

Browse files
committed
Implement Base.IndexStyle for PyObjectArray using a type argument
Base already defines a IndexStyle(::AbstractArray) method for object arguments that uses the object type, so we can implement that directly and avoid the invalidations from implement Base.IndexStyle(::PyObjectArray).
1 parent 625f786 commit f026cfe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/JlWrap/objectarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PyObjectArray(x::AbstractArray{T,N}) where {T,N} = PyObjectArray{N}(x)
1010

1111
pyobjectarray_finalizer(x::PyObjectArray) = GC.enqueue_all(x.ptrs)
1212

13-
Base.IndexStyle(x::PyObjectArray) = Base.IndexStyle(x.ptrs)
13+
Base.IndexStyle(T::Type{<: PyObjectArray}) = Base.IndexStyle(fieldtype(T, :ptrs))
1414

1515
Base.length(x::PyObjectArray) = length(x.ptrs)
1616

0 commit comments

Comments
 (0)