LinearAlgebra: unstable return value, affected by lazy string & @show
in error path #1064
Closed
Description
Seen on this 1.10 backports PR JuliaLang/julia#53714 but the problematic commit was reverted on that PR feceefe
(#53714)
Quoting JuliaLang/julia#53714 (comment)
I confirmed locally that this error was introduced by feceefe
(#53714)
tr: Test Failed at /Users/ian/Documents/GitHub/alts/julia/stdlib/LinearAlgebra/test/symmetric.jl:224
Expression: tr(aherm) == tr(Hermitian(aherm))
Evaluated: 2.6298493464368606 + 0.0im == 2.62984934643686
which is weird for just a change switching to lazy strings?
diff --git a/stdlib/LinearAlgebra/src/LinearAlgebra.jl b/stdlib/LinearAlgebra/src/LinearAlgebra.jl
index 494572b1e8dd8..7b3ff8f0db53d 100644
--- a/stdlib/LinearAlgebra/src/LinearAlgebra.jl
+++ b/stdlib/LinearAlgebra/src/LinearAlgebra.jl
@@ -238,14 +238,14 @@ julia> LinearAlgebra.checksquare(A, B)
"""
function checksquare(A)
m,n = size(A)
- m == n || throw(DimensionMismatch("matrix is not square: dimensions are $(size(A))"))
+ m == n || throw(DimensionMismatch(lazy"matrix is not square: dimensions are $(size(A))"))
m
end
function checksquare(A...)
sizes = Int[]
for a in A
- size(a,1)==size(a,2) || throw(DimensionMismatch("matrix is not square: dimensions are $(size(a))"))
+ size(a,1)==size(a,2) || throw(DimensionMismatch(lazy"matrix is not square: dimensions are $(size(a))"))
push!(sizes, size(a,1))
end
return sizes
Specifically, reverting just this one makes tests pass
https://github.com/JuliaLang/julia/blob/97b0571cbd74cfc7959fe065b5dfc47d0636fc4e/stdlib/LinearAlgebra/src/LinearAlgebra.jl#L241
Also leaving it lazy and adding a @show m
under that line makes test pass