From f801a2c73a6468ebc74605ba6cbefaf19d654e5d Mon Sep 17 00:00:00 2001 From: Petr Vana Date: Mon, 28 Mar 2022 19:34:22 +0200 Subject: [PATCH 1/2] Remove dead code + add error message --- base/dict.jl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/base/dict.jl b/base/dict.jl index 1ad84df0aa89e..fe51e10d3ecd6 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -223,11 +223,6 @@ end keys[index] = k vals[index] = v count += 1 - - if h.age != age0 - # if `h` is changed by a finalizer, retry - return rehash!(h, newsz) - end end end @@ -237,7 +232,7 @@ end h.count = count h.ndel = 0 h.maxprobe = maxprobe - @assert h.age == age0 + @assert h.age == age0 "Muliple concurent writes to Dict detected!" return h end From d18b4c22e7964b312dda9715cf01d11a5664c3a6 Mon Sep 17 00:00:00 2001 From: Petr Vana Date: Mon, 28 Mar 2022 22:23:54 +0200 Subject: [PATCH 2/2] Move assertion as suggested --- base/dict.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/dict.jl b/base/dict.jl index fe51e10d3ecd6..22ca27af4f2fa 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -226,14 +226,16 @@ end end end + @assert h.age == age0 "Muliple concurent writes to Dict detected!" + + h.age += 1 h.slots = slots h.keys = keys h.vals = vals h.count = count h.ndel = 0 h.maxprobe = maxprobe - @assert h.age == age0 "Muliple concurent writes to Dict detected!" - + return h end