From 5055d33d5d76c743703734164da4f965c80879da Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Fri, 3 Oct 2025 18:48:04 +0000 Subject: [PATCH] Fix compatibility with Julia 1.13+ memhash removal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove hash method definition when Base.memhash is not available. On Julia 1.13+, these AbstractString types will use the default AbstractString hash implementation which is now efficient and zero-copy based on codeunit/iterate. For Julia <1.13, continue using the memhash-based implementation for compatibility. Related to JuliaLang/julia#59697 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/strings.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/strings.jl b/src/strings.jl index f25dfe2..ce64942 100644 --- a/src/strings.jl +++ b/src/strings.jl @@ -5,9 +5,11 @@ struct PointerString <: AbstractString len::Int end -function Base.hash(s::PointerString, h::UInt) - h += Base.memhash_seed - ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h +if isdefined(Base, :memhash) + function Base.hash(s::PointerString, h::UInt) + h += Base.memhash_seed + ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h + end end import Base: ==