Deepcopy Fix#56990
Deepcopy Fix#56990KristofferC merged 10 commits intoJuliaLang:masterfrom willtebbutt:wct/deepcopy-fix
Conversation
|
Another option which registers the new copied item in the stackdict before recursing to the children is function deepcopy_internal(x::Array{T, N}, stackdict::IdDict) where {T, N}
if haskey(stackdict, x)
return stackdict[x]::typeof(x)
end
y = stackdict[x] = Array{T, N}(undef, ntuple(Returns(0), Val{N}()))
setfield!(y, :ref, deepcopy_internal(x.ref, stackdict))
setfield!(y, :size, x.size)
y
endI'm worried about calling |
I'd put tests for this here: Line 255 in b58dcc5 |
I'm happy to go with whichever is preferred -- I'll wait for @oscardssmith to weigh in before modifying. |
|
Calling |
|
Cool. I'll change the fix. |
|
Fix modified to following @LilithHafner 's suggestion, which I agree is probably cleaner. Test also fixed to actually be a test, rather than just evaluating a |
|
Is this triggering a Revise.jl internal bug? |
|
It looks like the |
Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
|
It looks to me like the current test failures are unrelated to this PR, but someone who knows more about Julia's CI should probably take a look. |
Co-authored-by: Neven Sajko <4944410+nsajko@users.noreply.github.com>
Resolves #56775 . Credit for this fix rests entirely with @bbrehm .
I have a regression test -- see #56775 (comment) -- but I'm unsure where to put it. If someone could point me towards an appropriate location for the test, that would be very helpful!
edit: CC @nsajko