-
-
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
workaround wrong paths reported for stdlib functions #32763
Conversation
Maybe add this for |
Something holding this from being merged? Would be nice to have this issue fixed. |
758a381
to
8bd5da3
Compare
2cda8ba
to
748d69c
Compare
I improved the implementation a bit but should be good to go now. Tried it locally with the executable built by the buildbot and |
Yeah, going with something, anything, is better than being always broken. |
base/methodshow.jl
Outdated
# This function does the method location updating | ||
function updated_methodloc(m) | ||
file, line = invokelatest(methodloc_callback[], m) | ||
if file !== nothing && isdefined(@__MODULE__, :Sys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if file !== nothing && isdefined(@__MODULE__, :Sys) | |
if file !== nothing && Sys.BUILD_STDLIB_PATH != Sys.STDLIB |
Is Sys ever not defined?
And should we put this inside default_methodloc
, or do we want to do this unconditionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not defined when this function gets defined and I was worried if there was some error before Sys
gets defined then it would crash when trying to print some method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to do this unconditionally.
base/methodshow.jl
Outdated
@@ -248,7 +258,7 @@ function show_method_table(io::IO, ms::MethodList, max::Int=-1, header::Bool=tru | |||
show(io, meth; kwtype=kwtype) | |||
file, line = meth.file, meth.line | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these try; catch
inside updated_methodloc
also
base/methodshow.jl
Outdated
# BUILD_STDLIB_PATH gets defined in sysinfo.jl | ||
file = replace(String(file), normpath(Sys.BUILD_STDLIB_PATH) => normpath(Sys.STDLIB)) | ||
end | ||
return Symbol(file), line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Symbol(file), line | |
return string(file), line |
base/methodshow.jl
Outdated
@@ -118,6 +118,16 @@ end | |||
default_methodloc(method::Method) = method.file, method.line | |||
const methodloc_callback = Ref{Function}(default_methodloc) | |||
|
|||
# This function does the method location updating | |||
function updated_methodloc(m) | |||
file, line = invokelatest(methodloc_callback[], m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file, line = invokelatest(methodloc_callback[], m) | |
file, line = try | |
invokelatest(methodloc_callback[], m) | |
catch | |
default_methodloc(m) | |
end | |
file === nothing && return (string(m.file), m.line) | |
file = string(file) |
base/methodshow.jl
Outdated
@@ -118,6 +118,16 @@ end | |||
default_methodloc(method::Method) = method.file, method.line | |||
const methodloc_callback = Ref{Function}(default_methodloc) | |||
|
|||
# This function does the method location updating | |||
function updated_methodloc(m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function updated_methodloc(m) | |
function updated_methodloc(m)::Tuple{String, Int32} |
Can this still make it into 1.3 or does the feature freeze prohibit it? |
It will not make it into 1.3.0 for sure. Maybe 1.3.1. |
Btw as this request is called workaround, I guess you'd not call it the idiomatic way. |
29dac94
to
cf492f1
Compare
I dunno... If it works, it works:P I did some fixups here @vtjnash |
cf492f1
to
9e9b84c
Compare
9e9b84c
to
fffe94f
Compare
fffe94f
to
caa35be
Compare
Does
|
I guess |
Sad that it won't make it into 1.3 even though it is already merged 🙈 |
Could be put into 1.3.1 if it doesnt cause any problems on master. |
I'm begging for it! This has been bugging me for way too long now. 😊 |
I have my script set to ignore backport labels that also has a triage label because we said we would triage backports at some point. This doesn't seem to happen though so the result is that PRs (like this) just get forgotten. I'll just backport stuff that includes the triage label as well. |
Not really clean to special case it just ofr
less
andedit
but that is where people seems to encounter this issue the most. The workaround could potentially be put infind_source_file
but that is a bit more "invasive".This is also kinda hard to test. I tested it by evaluating this into
InteractveUtils
in a released julia.Fixes #26314