Skip to content

Commit

Permalink
fix #13124, shared references to arrays in deepcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Oct 23, 2015
1 parent ce21e42 commit be56cf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/deepcopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ end

function _deepcopy_array_t(x, T, stackdict::ObjectIdDict)
if isbits(T)
return copy(x)
return (stackdict[x]=copy(x))
end
dest = similar(x)
stackdict[x] = dest
Expand Down
7 changes: 7 additions & 0 deletions test/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ let a = Any[[1]], q = QuoteNode([1])
@test dca[1] !== a[1]
@test deepcopy(q).value !== q.value
end

# issue #13124
let a = rand(3, 5)
b = (a,a)
c = deepcopy(b)
@test c[1] === c[2]
end

0 comments on commit be56cf8

Please sign in to comment.