Skip to content

Commit

Permalink
fix deepcopy of IdDict. same issue as #19921. (#26136)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Feb 22, 2018
1 parent 4115c9c commit f82e845
Show file tree
Hide file tree
Showing 2 changed files with 11 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 @@ -96,7 +96,7 @@ function _deepcopy_array_t(@nospecialize(x), T, stackdict::IdDict)
return dest
end

function deepcopy_internal(x::Dict, stackdict::IdDict)
function deepcopy_internal(x::Union{Dict,IdDict}, stackdict::IdDict)
if haskey(stackdict, x)
return stackdict[x]::typeof(x)
end
Expand Down
10 changes: 10 additions & 0 deletions test/copy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,14 @@ end
@test bar2.foo keys(bar2.fooDict)
@test bar2.fooDict[bar2.foo] != nothing
end

let d = IdDict(rand(2) => rand(2) for i = 1:100)
d2 = deepcopy(d)
for k in keys(d2)
@test haskey(d2, k)
end
for k in keys(d)
@test haskey(d, k)
end
end
end

2 comments on commit f82e845

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.