Skip to content

Commit

Permalink
generate_precompile: Move parsing into try/catch (JuliaLang#39592)
Browse files Browse the repository at this point in the history
Our printing for precompile statements is not 100% reliable (JuliaLang#28808)
and can fail. I introduced the extra `parse` call in the Varargs
change, but because of JuliaLang#28808, it needs to go inside the try/catch.
  • Loading branch information
Keno authored and ElOceanografo committed May 4, 2021
1 parent a5a3d65 commit 978debd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions contrib/generate_precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,23 +353,23 @@ function generate_precompile_statements()
# println(statement)
# The compiler has problem caching signatures with `Vararg{?, N}`. Replacing
# N with a large number seems to work around it.
ps = Meta.parse(statement)
if isexpr(ps, :call)
if isexpr(ps.args[end], :curly)
l = ps.args[end]
if length(l.args) == 2 && l.args[1] == :Vararg
push!(l.args, 100)
try
ps = Meta.parse(statement)
if isexpr(ps, :call)
if isexpr(ps.args[end], :curly)
l = ps.args[end]
if length(l.args) == 2 && l.args[1] == :Vararg
push!(l.args, 100)
end
end
end
end
try
# println(ps)
Core.eval(PrecompileStagingArea, ps)
n_succeeded += 1
print("\rExecuting precompile statements... $n_succeeded/$(length(statements))")
catch
# See #28808
@error "Failed to precompile $statement"
# @error "Failed to precompile $statement"
end
end
println()
Expand Down

0 comments on commit 978debd

Please sign in to comment.