-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in stacktrace collection with macros #31830
Comments
In my travis logs, the most recent julia version that passed Rebugger's tests was 1.2.0-DEV.516 (March 20). |
Here's the standalone test I used for the bisection: f() = error("oops")
macro g()
f()
nothing
end
ex = :(@g)
err, trace = try
eval(ex)
catch err
err, stacktrace(catch_backtrace())
end
@assert err.error == ErrorException("oops")
@assert any(sf->sf.func == :f, trace) |
Hi Tim, good example + sleuthing, cheers! I guess this would be due to the change in That is, I think the previous behavior would be recovered by reverting the change to the following line which was introduced in d3dbe86: Lines 1053 to 1054 in dc6c7c7
Now, the intention of this change was to stop pretending that the f() = error("oops")
macro g()
f()
nothing
end
ex = :(@g)
stk = try
eval(ex)
catch
Base.catch_stack()
end
for (i,(err,trace)) in reverse(collect(enumerate(stk)))
println("**** Exception number $i ($(typeof(err)))")
Base.showerror(stdout, err, trace, backtrace=true)
println()
end Output (note that
So while this is not exactly a bug, it's certainly a change in behavior. I wonder what the best approach is. |
Oh, very interesting. I am so short on time these days that I didn't have time to dig into this change, so I really appreciate your guidance. Given these constraints, I can't intelligently comment ATM on what approach should be taken to deal with this as a regression; the two options appear to be change how it works or to document it. If we keep it (and at first glance does seem nice), AFAICT there does not seem to be a NEWS entry about this; since it is breaking, at least a NEWS entry would seem essential for the Julia 1.2 release. If the new behavior is retained, you've given me enough to introduce some VERSION-dependent code in Rebugger that will enable it to work across Julia versions. I'll be watching for the verdict. |
There's at least two problems here:
So there's a few possible solutions:
As a matter of moving forward I prefer the third of these. This requires that our backtraces are reliable enough that this is not a step backward in error reporting. I'm convinced this is true on linux, but I can't comment on other platforms. |
I looked into removing @test_throws LoadError macroexpand(#= something =#) In this case the Notably, |
Well, I've put up a PR for removing Sticking point is whether this can be considered a minor change or is just too breaking. |
It took a bit of work, but deprecating |
This also breaks Juno's stacktrace display (see JunoLab/Juno.jl#242), because we use a very similar pattern to what Tim shows above:
It would be easy enough to change this to e.g.
But we definitely need one of the suggested solutions for the 1.2 release, even if it's only a NEWS.md entry. |
This comes from one of Rebugger's tests.
On a recent master:
Note the first entry is
eval
, and contains nothing about the actual functions that threw the error when the macro was evaluated.Compare julia 1.1:
Here we see references to
parse_hsl_hue
etc.The text was updated successfully, but these errors were encountered: