Skip to content

Commit 8e67f99

Browse files
authored
fix functional assert statements (#53737)
We currently never remove asserts but I still think this is not a good practice.
1 parent a9611ce commit 8e67f99

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

base/loading.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,7 +3770,7 @@ function precompile(@nospecialize(argt::Type), m::Method)
37703770
return precompile(mi)
37713771
end
37723772

3773-
@assert precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), Nothing))
3774-
@assert precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), String))
3775-
@assert precompile(create_expr_cache, (PkgId, String, String, String, typeof(_concrete_dependencies), Cmd, IO, IO))
3776-
@assert precompile(create_expr_cache, (PkgId, String, String, Nothing, typeof(_concrete_dependencies), Cmd, IO, IO))
3773+
precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), Nothing)) || @assert false
3774+
precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), String)) || @assert false
3775+
precompile(create_expr_cache, (PkgId, String, String, String, typeof(_concrete_dependencies), Cmd, IO, IO)) || @assert false
3776+
precompile(create_expr_cache, (PkgId, String, String, Nothing, typeof(_concrete_dependencies), Cmd, IO, IO)) || @assert false

base/pkgid.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ end
3737

3838
function binunpack(s::String)
3939
io = IOBuffer(s)
40-
@assert read(io, UInt8) === 0x00
40+
z = read(io, UInt8)
41+
@assert z === 0x00
4142
uuid = read(io, UInt128)
4243
name = read(io, String)
4344
return PkgId(UUID(uuid), name)

base/threadingconstructs.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ function threading_run(fun, static)
158158
else
159159
# TODO: this should be the current pool (except interactive) if there
160160
# are ever more than two pools.
161-
@assert ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default)) == 1
161+
_result = ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, _sym_to_tpid(:default))
162+
@assert _result == 1
162163
end
163164
tasks[i] = t
164165
schedule(t)
@@ -410,7 +411,8 @@ function _spawn_set_thrpool(t::Task, tp::Symbol)
410411
if tpid == -1 || _nthreads_in_pool(tpid) == 0
411412
tpid = _sym_to_tpid(:default)
412413
end
413-
@assert ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, tpid) == 1
414+
_result = ccall(:jl_set_task_threadpoolid, Cint, (Any, Int8), t, tpid)
415+
@assert _result == 1
414416
nothing
415417
end
416418

0 commit comments

Comments
 (0)