From cdcb0af88932bb0f02ef4ae27a9e5aefef407312 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 14 Mar 2024 16:03:51 -0400 Subject: [PATCH] fix functional assert statements --- base/loading.jl | 8 ++++---- base/pkgid.jl | 3 ++- base/threadingconstructs.jl | 6 ++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 774aa22bdacbd..883e980b4000a 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -3770,7 +3770,7 @@ function precompile(@nospecialize(argt::Type), m::Method) return precompile(mi) end -@assert precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), Nothing)) -@assert precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), String)) -@assert precompile(create_expr_cache, (PkgId, String, String, String, typeof(_concrete_dependencies), Cmd, IO, IO)) -@assert precompile(create_expr_cache, (PkgId, String, String, Nothing, typeof(_concrete_dependencies), Cmd, IO, IO)) +precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), Nothing)) || @assert false +precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), String)) || @assert false +precompile(create_expr_cache, (PkgId, String, String, String, typeof(_concrete_dependencies), Cmd, IO, IO)) || @assert false +precompile(create_expr_cache, (PkgId, String, String, Nothing, typeof(_concrete_dependencies), Cmd, IO, IO)) || @assert false diff --git a/base/pkgid.jl b/base/pkgid.jl index a3d3ead184bb8..8c776d79a69cb 100644 --- a/base/pkgid.jl +++ b/base/pkgid.jl @@ -37,7 +37,8 @@ end function binunpack(s::String) io = IOBuffer(s) - @assert read(io, UInt8) === 0x00 + z = read(io, UInt8) + @assert z === 0x00 uuid = read(io, UInt128) name = read(io, String) return PkgId(UUID(uuid), name) diff --git a/base/threadingconstructs.jl b/base/threadingconstructs.jl index 56d596958bc7e..60aea04ddba64 100644 --- a/base/threadingconstructs.jl +++ b/base/threadingconstructs.jl @@ -158,7 +158,8 @@ function threading_run(fun, static) else # TODO: this should be the current pool (except interactive) if there # are ever more than two pools. - @assert ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default)) == 1 + _result = ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default)) + @assert _result == 1 end tasks[i] = t schedule(t) @@ -410,7 +411,8 @@ function _spawn_set_thrpool(t::Task, tp::Symbol) if tpid == -1 || _nthreads_in_pool(tpid) == 0 tpid = _sym_to_tpid(:default) end - @assert ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, tpid) == 1 + _result = ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, tpid) + @assert _result == 1 nothing end