Skip to content

Conversation

@JamesWrigley
Copy link
Contributor

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). Fixes these invalidations:

 inserting IndexStyle(x::PythonCall.PyObjectArray) @ PythonCall.JlWrap ~/.julia/dev/PythonCall/src/JlWrap/objectarray.jl:13 invalidated:                                                                                                       
   backedges: 1: superseding IndexStyle(A::AbstractArray) @ Base indices.jl:94 with MethodInstance for IndexStyle(::AbstractArray) (132 children) 

@JamesWrigley
Copy link
Contributor Author

I took the liberty of removing some Dates.value() methods in 7766cc8 that seem unnecessary, on the Julia 1.12.2 backports branch that fixes these invalidations:

 inserting value(d::PythonCall.NumpyDates.TimeDelta64) @ PythonCall.NumpyDates /gpfs/exfel/data/scratch/wrigleyj/julia-depot/packages/PythonCall/MxsO4/src/NumpyDates/TimeDelta64.jl:26 invalidated:
   backedges: 1: superseding value(x::Dates.Period) @ Dates ~/src/julia/usr/share/julia/stdlib/v1.12/Dates/src/periods.jl:10 with MethodInstance for Dates.value(::Dates.Period) (285 children)

Bringing the total number of invalidations for v1 on the future 1.12.2 release down to 340 :)

@cjdoris
Copy link
Member

cjdoris commented Nov 14, 2025

LGTM but can you change this to target the main branch as this isn't a breaking change. I merge main into v1 periodically.

@JamesWrigley JamesWrigley changed the base branch from v1 to main November 14, 2025 09:32
@JamesWrigley
Copy link
Contributor Author

Sure, done.

@cjdoris
Copy link
Member

cjdoris commented Nov 14, 2025

Oh the tests aren't running because changing the base doesn't trigger them... Can you push a trivial commit (or two commits to get back to the current state) to trigger it? It'll all get squashed away anyway. Or maybe there is a more elegant way.

- 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`.
@JamesWrigley
Copy link
Contributor Author

I squashed them in e3e4f6a, that seems to have done the trick.

@cjdoris cjdoris merged commit c1b9d54 into JuliaPy:main Nov 14, 2025
15 of 16 checks passed
@cjdoris
Copy link
Member

cjdoris commented Nov 14, 2025

Thanks!

@JamesWrigley JamesWrigley deleted the indexstyle branch November 14, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants