-
-
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
deprecation warning is only printed once #22043
Comments
Bisected to c8026a9 and also ref #21367 (comment) which I also experienced writing tests for #22034 |
Actually, its not just c8026a9, reverting that makes the warning print every time, so it has to be something else (perhaps a combination?). This is master with c8026a9 reverted: julia> f2(x) = 2;
julia> @deprecate f1(x) f2(x);
julia> f1(1)
WARNING: f1(x) is deprecated, use f2(x) instead.
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
[2] f1(::Int64) at ./deprecated.jl:57
[3] eval(::Module, ::Any) at ./boot.jl:235
[4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[5] macro expansion at ./REPL.jl:97 [inlined]
[6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
2
julia> f1(1)
WARNING: f1(x) is deprecated, use f2(x) instead.
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
[2] f1(::Int64) at ./deprecated.jl:57
[3] eval(::Module, ::Any) at ./boot.jl:235
[4] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[5] macro expansion at ./REPL.jl:97 [inlined]
[6] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
2 |
Perhaps this is only an issue in global scope. Example from top post, but calling julia> f2(x) = 2; f4(x) = 4;
julia> @deprecate f1(x) f2(x);
julia> @deprecate f3(x) f4(x);
julia> function foo()
f1(1)
f3(1)
end
foo (generic function with 1 method)
julia> foo()
WARNING: f1(x) is deprecated, use f2(x) instead.
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
[2] f1(::Int64) at ./deprecated.jl:57
[3] foo() at ./REPL[4]:2
[4] eval(::Module, ::Any) at ./boot.jl:236
[5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[6] macro expansion at ./REPL.jl:97 [inlined]
[7] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
WARNING: f3(x) is deprecated, use f4(x) instead.
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
[2] f3(::Int64) at ./deprecated.jl:57
[3] foo() at ./REPL[4]:3
[4] eval(::Module, ::Any) at ./boot.jl:236
[5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[6] macro expansion at ./REPL.jl:97 [inlined]
[7] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
while loading no file, in expression starting on line 0
4
julia> foo()
4 |
This seems to be because a given line number of prompt input is always considered the "same location", and warnings are uniqued by the location of the deprecated call. If you do e.g.
you get a warning because the call is now on line 2 instead of line 1. |
Just a heads-up that I've been changing the depwarn system a bit over at #24490, which should put the deduplication logic squarely in the hands of the user, rather than being locked away in a global As part of these changes, I've set the log record report = depwarn_report() do
# your code here
end The new system allows this to produce identical results each time, as the deduplication is under control of the currently installed logger. |
fixed by the logging pr |
Ref #22034 (comment), on 0.6 and master I can only produce one deprecation warning per julia session.
master and 0.6-rc2:
And on 0.5.2:
Seems like a bad bug in these days of new releases and fixing deprecation warnings.
The text was updated successfully, but these errors were encountered: