-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deepcopy Fix #56990
Deepcopy Fix #56990
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
end I'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 <[email protected]>
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 <[email protected]>
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