Skip to content

Conversation

mkitti
Copy link
Collaborator

@mkitti mkitti commented Sep 25, 2025

Fix #630

Indexing by non-integers was deprecated in #226 in the year 2018 with v0.9 and removed in #579 in the year 2025 with v0.16. However, removal of the deprecation results in a StackOverflow as per #630.

The immediate fix is to re-add the methods but have them result in an error providing guidance on how to modify the deprecated behavior.

In the longer term, the custom Base.to_index needs to be removed.

Base.to_index(::AbstractInterpolation, x::Number) = x

Consequently, we should also not use to_indices to process arguments when using the function calling interface. This change is significantly more involved and may result in further breakage. For example, it is not clear if the function calling interface should support CartesianIndex as an argument or not.

The MWE in #630 now results in the following error.

julia> using Interpolations

julia> itp = interpolate(ones(100,100), BSpline(Linear()));

julia> r = itp[2.2, 33.3]
ERROR: Indexing an AbstractInterpolation by non-integers is no longer supported in Interpolations.jl since v0.16. Use the function calling interface instead: `itp(i...)`.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] getindex(::Interpolations.BSplineInterpolation{Float64, 2, Matrix{Float64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, ::Float64, ::Float64)
   @ Interpolations ~/.julia/dev/Interpolations/src/deprecations.jl:2
 [3] top-level scope
   @ REPL[3]:1

@mkitti mkitti mentioned this pull request Sep 25, 2025
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.11%. Comparing base (7a2d581) to head (d9b6b3e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #633      +/-   ##
==========================================
+ Coverage   88.10%   88.11%   +0.01%     
==========================================
  Files          29       29              
  Lines        1908     1910       +2     
==========================================
+ Hits         1681     1683       +2     
  Misses        227      227              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Stack Overflow

1 participant