From 7f2d12fa7b03379437c6291c8a962aab73c3990e Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Mon, 21 Sep 2026 12:44:13 +0200 Subject: [PATCH 1/2] fix: `Base._unsetindex!` -> `Base.unsetindex!` Julia 1.14 introduced a public API for `Base._unsetindex!` and adds a deprecation warning for the old, private `Base._unsetindex!`. This change adds an `isdefined` check that uses the `Base.unsetindex!` definition if it is present, and falls back to the `Base._unsetindex!` definition if not. Closes: #986. --- src/DataStructures.jl | 7 +++++++ src/circ_deque.jl | 4 ++-- src/deque.jl | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/DataStructures.jl b/src/DataStructures.jl index 5e5d767ec..4cfce3411 100644 --- a/src/DataStructures.jl +++ b/src/DataStructures.jl @@ -7,6 +7,13 @@ module DataStructures import Base.insert! + # public unsetindex! API introduced in 1.14 (julia#58943) + if isdefined(Base, :unsetindex!) + using Base: unsetindex! + else + unsetindex!(A, i) = Base._unsetindex!(A, i) + end + using OrderedCollections using OrderedCollections: isordered export OrderedDict, OrderedSet, LittleDict diff --git a/src/circ_deque.jl b/src/circ_deque.jl index fcf303ca3..598409134 100644 --- a/src/circ_deque.jl +++ b/src/circ_deque.jl @@ -64,7 +64,7 @@ end @inline Base.@propagate_inbounds function Base.pop!(D::CircularDeque) v = last(D) - Base._unsetindex!(D.buffer, D.last) # see issue/884 + unsetindex!(D.buffer, D.last) # see issue/884 D.n -= 1 tmp = D.last - 1 D.last = ifelse(tmp < 1, D.capacity, tmp) @@ -92,7 +92,7 @@ Remove the element at the front. """ @inline Base.@propagate_inbounds function Base.popfirst!(D::CircularDeque) v = first(D) - Base._unsetindex!(D.buffer, D.first) # see issue/884 + unsetindex!(D.buffer, D.first) # see issue/884 D.n -= 1 tmp = D.first + 1 D.first = ifelse(tmp > D.capacity, 1, tmp) diff --git a/src/deque.jl b/src/deque.jl index d1b1bb163..b123bb263 100644 --- a/src/deque.jl +++ b/src/deque.jl @@ -297,7 +297,7 @@ function Base.pop!(d::Deque{T}) where T @assert rear.back >= rear.front @inbounds x = rear.data[rear.back] - Base._unsetindex!(rear.data, rear.back) # see issue/884 + unsetindex!(rear.data, rear.back) # see issue/884 rear.back -= 1 if rear.back < rear.front if d.nblocks > 1 @@ -323,7 +323,7 @@ function Base.popfirst!(d::Deque{T}) where T @assert head.back >= head.front @inbounds x = head.data[head.front] - Base._unsetindex!(head.data, head.front) # see issue/884 + unsetindex!(head.data, head.front) # see issue/884 head.front += 1 if head.back < head.front if d.nblocks > 1 From bbbead4936d15ee94a09100b7c702ff1f191f101 Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Fri, 2 Oct 2026 08:35:02 +0200 Subject: [PATCH 2/2] Apply suggestion from @nsajko Co-authored-by: Neven Sajko --- src/DataStructures.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DataStructures.jl b/src/DataStructures.jl index 4cfce3411..191a480c1 100644 --- a/src/DataStructures.jl +++ b/src/DataStructures.jl @@ -11,7 +11,7 @@ module DataStructures if isdefined(Base, :unsetindex!) using Base: unsetindex! else - unsetindex!(A, i) = Base._unsetindex!(A, i) + using Base: _unsetindex! as unsetindex! end using OrderedCollections