Skip to content

Commit 8d223ac

Browse files
committed
to_indices before checkbounds
1 parent 70c135e commit 8d223ac

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "3.2"
3+
version = "3.2.1"
44

55
[deps]
66
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"

src/indexing.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,14 @@ Changing indexing based on a given argument from `args` should be done through,
303303
[`to_index`](@ref), or [`to_axis`](@ref).
304304
"""
305305
function getindex(A, args...)
306-
@boundscheck checkbounds(A, args...)
307-
unsafe_getindex(A, to_indices(A, args)...)
306+
inds = to_indices(A, args)
307+
@boundscheck checkbounds(A, inds...)
308+
unsafe_getindex(A, inds...)
308309
end
309310
function getindex(A; kwargs...)
310-
args = order_named_inds(dimnames(A), values(kwargs))
311-
@boundscheck checkbounds(A, args...)
312-
unsafe_getindex(A, to_indices(A, args)...)
311+
inds = to_indices(A, order_named_inds(dimnames(A), values(kwargs)))
312+
@boundscheck checkbounds(A, inds...)
313+
unsafe_getindex(A, inds...)
313314
end
314315
@propagate_inbounds getindex(x::Tuple, i::Int) = getfield(x, i)
315316
@propagate_inbounds getindex(x::Tuple, ::StaticInt{i}) where {i} = getfield(x, i)

0 commit comments

Comments
 (0)