Skip to content

Commit f346ccf

Browse files
vtjnashclaude
andcommitted
Fix compatibility with Julia 1.13+ memhash removal
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 <[email protected]>
1 parent 04ec1cf commit f346ccf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/utils.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,11 @@ struct PointerString
578578
len::Int
579579
end
580580

581-
function Base.hash(s::PointerString, h::UInt)
582-
h += Base.memhash_seed
583-
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h
581+
if isdefined(Base, :memhash)
582+
function Base.hash(s::PointerString, h::UInt)
583+
h += Base.memhash_seed
584+
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h
585+
end
584586
end
585587

586588
import Base: ==

0 commit comments

Comments
 (0)