From 8f512845ab9ae429d469b1c4833c4113261c061f Mon Sep 17 00:00:00 2001 From: Andy Dienes Date: Thu, 19 Mar 2026 16:42:18 -0400 Subject: [PATCH] Fix incorrect one-arg Base.hash for ArgumentWrapper Generated as part of an ecosystem-wide audit for one-arg hash methods. The `Base.hash(aw::ArgumentWrapper)` method only defines a one-arg `Base.hash`, causing the two-arg fallback to use `objectid`-based hashing. This can cause correctness issues when ArgumentWrappers are used in hash-based containers. With Julia 1.13+, the default hash seed is changing from `zero(UInt)` to a random value, which will make the one-arg method produce different results each session. This does not affect `==`/`isequal`, which compare the `.hash` field directly rather than calling `Base.hash()`. Co-Authored-By: Claude --- src/datadeps/aliasing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datadeps/aliasing.jl b/src/datadeps/aliasing.jl index 260af39ce..bde4d9a5f 100644 --- a/src/datadeps/aliasing.jl +++ b/src/datadeps/aliasing.jl @@ -229,7 +229,7 @@ struct ArgumentWrapper return new(arg, dep_mod, h) end end -Base.hash(aw::ArgumentWrapper) = hash(ArgumentWrapper, aw.hash) +Base.hash(aw::ArgumentWrapper, h::UInt) = hash(aw.hash, hash(ArgumentWrapper, h)) Base.:(==)(aw1::ArgumentWrapper, aw2::ArgumentWrapper) = aw1.hash == aw2.hash Base.isequal(aw1::ArgumentWrapper, aw2::ArgumentWrapper) =