Skip to content

Commit e3e4f6a

Browse files
committed
Fix some sources of invalidations
- 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). - The Dates stdlib already defines a method that does the same thing for any `Period`.
1 parent 625f786 commit e3e4f6a

File tree

3 files changed

+1
-5
lines changed

3 files changed

+1
-5
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

src/NumpyDates/InlineTimeDelta64.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ end
2424

2525
# accessors
2626

27-
Dates.value(d::InlineTimeDelta64) = d.value
28-
2927
unitpair(::InlineTimeDelta64{U}) where {U} = unitpair(U)
3028
unitpair(::Type{InlineTimeDelta64{U}}) where {U} = unitpair(U)
3129

src/NumpyDates/TimeDelta64.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ end
2323

2424
# accessors
2525

26-
Dates.value(d::TimeDelta64) = d.value
27-
2826
unitpair(d::TimeDelta64) = d.unit
2927

3028
# constructors

0 commit comments

Comments
 (0)