-
-
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
disable method overwrite warnings if both functions are in Main #18746
Conversation
5097b2a
to
4f20093
Compare
can we make this only the case when |
t = redirected_stderr("WARNING: Method definition f_overwrite_module(Any) in module F18725") | ||
mktemp() do path, stream | ||
try | ||
include_string("""module F18725 |
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.
indent is off
wait(t) | ||
|
||
t = redirected_stderr("WARNING: Method definition f_overwrite_module(Any) in module F18725") | ||
mktemp() do path, stream |
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.
neither path or stream are used here, why the mktemp?
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.
Accident from previous test iterations :P
How should I test it then @tkelman. Start a new worker with the needed command flag? |
If that works? We don't do all that much testing of warnings, though that doesn't mean we shouldn't try to. |
Regarding julia> isinteractive()
true
julia> Base.JLOptions().isinteractive
0 because the function that starts the REPL sets the Line 346 in 0287a99
I could of course just |
If we are going to make this conditional on ccall(:jl_suppress_interactive_warnings, Cint, (Cint,), true) static int suppress_interactive_warnings;
JL_DLLEXPORT int jl_suppress_interactive_warnings(int nowarn)
{
int last = suppress_interactive_warnings;
suppress_interactive_warnings = nowarn;
return last;
} |
I think it would be better to simply add an option to disable the warning, at least until #265 is fixed. It's very hard to make the case that some method overwrites don't need warnings, and others do. |
I agree. |
Either this should be a warning or it shouldn't. This isn't really doing much to warn for #265 occurrences, since it only handles one very specific case, so that seems like a red herring.
Adding a flag is annoying since it's one more thing that will differ between master and worker processes. Jeff was the one who originally convinced me it's better to avoid options when we can just pick a sane default (such as warning only for code inside a module), or we could move this entirely to a linter. |
We already have an option to disable deprecation warnings, so options of this kind are clearly considered acceptable at this point. True, it does not catch all cases of #265, but the case in #18725 (comment) is especially bad, and I feel it's very helpful to give some indication of what might be wrong. Unlike other cases of #265, this one is actionable, since you can usually avoid overwriting methods (e.g. use different names instead of repeatedly redefining This warning is perfectly fine except in the marginal case where you reload lots of definitions and find the excess text annoying. An option seems like the right way to handle that, so that you can temporarily silence the warnings to make it easier to see other messages. |
How about showing it only once per session for Main Main overwrites? |
Implements @vtjnash suggestion in #18725 (comment)
fixes #18725
Stuff like JuliaPlots/Plots.jl#508 or
are of course a little bit scary to happen without a warning.