diff --git a/NEWS.md b/NEWS.md index 1ce80e71dd90c..137a501586f3b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -30,9 +30,13 @@ Build system changes New library functions --------------------- +Library changes +--------------- -New library features --------------------- +* A known concurrency issue of `iterate` methods on `Dict` and other derived objects such + as `keys(::Dict)`, `values(::Dict)`, and `Set` is fixed. These methods of `iterate` can + now be called on a dictionary or set shared by arbitrary tasks provided that there are no + tasks mutating the dictionary or set ([#44534]). Standard library changes diff --git a/base/dict.jl b/base/dict.jl index 53f760999482f..12ff26fbebe17 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -703,7 +703,7 @@ end @propagate_inbounds _iterate(t::Dict{K,V}, i) where {K,V} = i == 0 ? nothing : (Pair{K,V}(t.keys[i],t.vals[i]), i == typemax(Int) ? 0 : i+1) @propagate_inbounds function iterate(t::Dict) - _iterate(t, skip_deleted_floor!(t)) + _iterate(t, skip_deleted(t, t.idxfloor)) end @propagate_inbounds iterate(t::Dict, i) = _iterate(t, skip_deleted(t, i))