From 2db86f2360a03530b34b1d35bd86fb53fa841422 Mon Sep 17 00:00:00 2001 From: Steve Kelly Date: Tue, 15 Feb 2022 15:49:20 -0500 Subject: [PATCH] completely initialize SystemError (#44192) --- base/io.jl | 2 +- test/error.jl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/base/io.jl b/base/io.jl index 647406a437b2f..69972249be02f 100644 --- a/base/io.jl +++ b/base/io.jl @@ -20,7 +20,7 @@ struct SystemError <: Exception extrainfo SystemError(p::AbstractString, e::Integer, extrainfo) = new(p, e, extrainfo) SystemError(p::AbstractString, e::Integer) = new(p, e, nothing) - SystemError(p::AbstractString) = new(p, Libc.errno()) + SystemError(p::AbstractString) = new(p, Libc.errno(), nothing) end lock(::IO) = nothing diff --git a/test/error.jl b/test/error.jl index 38ea378664241..e9d011e382a61 100644 --- a/test/error.jl +++ b/test/error.jl @@ -81,3 +81,8 @@ end # non-Functions @test retry(Float64)(1) === 1.0 end + +@testset "SystemError initialization" begin + e = SystemError("fail") + @test e.extrainfo === nothing +end