From c1cfdcb6e3306f0b86afff636c235cc57a645af0 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sun, 26 May 2019 13:48:16 +0200 Subject: [PATCH] Fully qualify at-everywhere, fixes #28966. (#32144) (cherry picked from commit e6734fa5423b720329e7662c56cd7c3b5eaaebda) --- stdlib/Distributed/src/macros.jl | 2 +- stdlib/Distributed/test/distributed_exec.jl | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/stdlib/Distributed/src/macros.jl b/stdlib/Distributed/src/macros.jl index 4285073ec90a3..d85e2af8f2e7d 100644 --- a/stdlib/Distributed/src/macros.jl +++ b/stdlib/Distributed/src/macros.jl @@ -172,7 +172,7 @@ Equivalent to calling `remotecall_eval(Main, procs, expr)`. """ macro everywhere(ex) procs = GlobalRef(@__MODULE__, :procs) - return esc(:(@everywhere $procs() $ex)) + return esc(:($(Distributed).@everywhere $procs() $ex)) end macro everywhere(procs, ex) diff --git a/stdlib/Distributed/test/distributed_exec.jl b/stdlib/Distributed/test/distributed_exec.jl index aa462b73f0549..62cc8eeef4af2 100644 --- a/stdlib/Distributed/test/distributed_exec.jl +++ b/stdlib/Distributed/test/distributed_exec.jl @@ -1535,6 +1535,18 @@ for T in (UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64) @test n == 55 end +# issue #28966 +let code = """ + import Distributed + Distributed.addprocs(1) + Distributed.@everywhere f() = myid() + for w in Distributed.workers() + @assert Distributed.remotecall_fetch(f, w) == w + end + """ + @test success(`$(Base.julia_cmd()) --startup-file=no -e $code`) +end + # Run topology tests last after removing all workers, since a given # cluster at any time only supports a single topology. rmprocs(workers())