-
Notifications
You must be signed in to change notification settings - Fork 11
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
Error when using anonymous functions with kwargs #104
Comments
Another intriguing observation: this does not fail
|
Hi all, Pablo created this useful test: Distributed.remotecall_eval(Main, 1, :(f = (; p = 2) -> 0))
Distributed.remotecall_eval(Main, 2, :(f = (; p = 2) -> 0))
remotecall_fetch(f, 2) #error
Distributed.remotecall_eval(Main, 1, :(g = () -> 0))
Distributed.remotecall_eval(Main, 2, :(g = () -> 0))
remotecall_fetch(g, 2) # no error We can observe what's actually happening on the workers: julia> Distributed.remotecall_eval(Main, 2, :(code_lowered(f)))
1-element Vector{Core.CodeInfo}:
CodeInfo(
1 ─ %1 = Main.:(var"#3#4")
│ %2 = (%1)(2, #self#)
└── return %2
)
julia> Distributed.remotecall_eval(Main, 2, :(code_lowered(g))) # g is observably simpler
1-element Vector{Core.CodeInfo}:
CodeInfo(
1 ─ return 0
)
julia> Distributed.remotecall_eval(Main, 2, :(code_lowered(var"#3#4")))
1-element Vector{Core.CodeInfo}:
CodeInfo(
1 ─ nothing
└── return 0
) Now the actual error is:
I assume that the sequence of events is as follows:
Notably, if passing the evaluation code through as normal manually-escaped expressions, all works OK, because julia> Distributed.remotecall_eval(Main, 2, :(f()))
0
|
Another clue from our conversation in slack. This variant works
There is a key difference between
|
I think we can reduce this further, and isolate it to an issue in Serialization itself (so we may need to move this issue) julia> f = (; p = 2) -> 0;
julia> using Serialization
julia> serialize("test.dat", f)
julia> deserialize("test.dat")
#1 (generic function with 1 method)
julia> ff = deserialize("test.dat")
#1 (generic function with 1 method)
julia> ff()
ERROR: MethodError: no method matching var"#1#2"(::Int64, ::Serialization.__deserialized_types__.var"##230")
The function `#1#2` exists, but no method is defined for this combination of argument types.
Closest candidates are:
var"#1#2"(::Any, ::var"#1#3")
@ Main REPL[2]:1
Stacktrace:
[1] (::Serialization.__deserialized_types__.var"##230")()
@ Main ./REPL[2]:1
[2] top-level scope
@ REPL[6]:1 This error does not arise if we do julia> genf() = (; p = 2) -> 0; f = genf(); |
Closing in favor of JuliaLang/julia#56815 |
This fails since at least 1.6 up until nightly
The error of the last call is
The text was updated successfully, but these errors were encountered: