Skip to content

Commit 8fe1d24

Browse files
fingolfinStefanKarpinski
authored andcommitted
Fix isless(::SHA1, ::SHA1) method (#29666)
Use isless instead of lexless. Fixes #29583
1 parent 4093dbf commit 8fe1d24

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

base/loading.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ string(hash::SHA1) = bytes2hex(hash.bytes)
9696
print(io::IO, hash::SHA1) = bytes2hex(io, hash.bytes)
9797
show(io::IO, hash::SHA1) = print(io, "SHA1(\"", hash, "\")")
9898

99-
isless(a::SHA1, b::SHA1) = lexless(a.bytes, b.bytes)
99+
isless(a::SHA1, b::SHA1) = isless(a.bytes, b.bytes)
100100
hash(a::SHA1, h::UInt) = hash((SHA1, a.bytes), h)
101101
==(a::SHA1, b::SHA1) = a.bytes == b.bytes
102102

test/loading.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ let shastr = "ab"^20
9393
@test "check $hash" == "check $shastr"
9494
end
9595

96+
let shastr1 = "ab"^20, shastr2 = "ac"^20
97+
hash1 = SHA1(shastr1)
98+
hash2 = SHA1(shastr2)
99+
@test isless(hash1, hash2)
100+
@test !isless(hash2, hash1)
101+
@test !isless(hash1, hash1)
102+
end
103+
96104
let uuidstr = "ab"^4 * "-" * "ab"^2 * "-" * "ab"^2 * "-" * "ab"^2 * "-" * "ab"^6
97105
uuid = UUID(uuidstr)
98106
@test uuid == eval(Meta.parse(repr(uuid))) # check show method

0 commit comments

Comments
 (0)