Skip to content

Commit

Permalink
Merge pull request #21799 from JuliaLang/jb/fix21793
Browse files Browse the repository at this point in the history
fix #21793, regression in serializing nested closure
  • Loading branch information
JeffBezanson authored May 12, 2017
2 parents 75ca24f + 4c54935 commit 9cac047
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 9cac047

Please sign in to comment.