Skip to content

Commit

Permalink
fix #21793, regression in serializing nested closure
Browse files Browse the repository at this point in the history
(cherry picked from commit 4c54935)
ref #21799
  • Loading branch information
JeffBezanson authored and tkelman committed May 14, 2017
1 parent b523b1e commit 0f1aa84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion base/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,8 @@ function handle_deserialize(s::AbstractSerializer, b::Int32)
return GlobalRef(deserialize(s)::Module, deserialize(s)::Symbol)
elseif b == FULL_GLOBALREF_TAG
ty = deserialize(s)
return GlobalRef(ty.name.module, ty.name.name)
tn = unwrap_unionall(ty).name
return GlobalRef(tn.module, tn.name)
elseif b == LONGTUPLE_TAG
return deserialize_tuple(s, Int(read(s.io, Int32)::Int32))
elseif b == LONGEXPR_TAG
Expand Down
9 changes: 9 additions & 0 deletions test/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,15 @@ main_ex = quote
$Test.@test g2() == :magic_token_anon_fun_test
$Test.@test g2() == :magic_token_anon_fun_test
$Test.@test deserialize(ds) === g2

# issue #21793
y = x -> (() -> x)
seekstart(s)
serialize(s, y)
seekstart(s)
y2 = deserialize(s)
x2 = y2(2)
$Test.@test x2() == 2
end
end
# This needs to be run on `Main` since the serializer treats it differently.
Expand Down

0 comments on commit 0f1aa84

Please sign in to comment.