Skip to content
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

Deep copying OrderedDicts #75

Closed
pcmoritz opened this issue Feb 15, 2015 · 3 comments
Closed

Deep copying OrderedDicts #75

pcmoritz opened this issue Feb 15, 2015 · 3 comments

Comments

@pcmoritz
Copy link

Dear all,

there might be an issue in how OrderedDicts are handled by deepcopy:

julia> d1 = OrderedDict([("hi", 1)])
OrderedDict{ASCIIString,Int64} with 1 entry:
  "hi" => 1

julia> d2 = deepcopy(d1)
OrderedDict{ASCIIString,Int64} with 1 entry:
  "hi" => 1

julia> d2["hi"] = 2
2

julia> d1
OrderedDict{ASCIIString,Int64} with 1 entry:
  "hi" => 2

I would expect a behaviour similar as this one:

julia> d1 = Dict([("hi", 1)])
Dict{ASCIIString,Int64} with 1 entry:
  "hi" => 1

julia> d2 = deepcopy(d1)
Dict{ASCIIString,Int64} with 1 entry:
  "hi" => 1

julia> d2["hi"] = 2
2

julia> d1
Dict{ASCIIString,Int64} with 1 entry:
  "hi" => 1

I am using Julia 0.3.5 and DataStructures 0.3.5.

Let me know if you have an idea where the problem is or if you have an idea for a workaround. Thanks in advance!

Best,
Philipp.

Edit: Added formatting (kms)

@kmsquire
Copy link
Member

kmsquire commented Mar 3, 2015

Interestingly, this works on v0.4.

@kmsquire
Copy link
Member

kmsquire commented Mar 3, 2015

This was fixed on Julia 0.4 by JuliaLang/julia#8560, but that was never backported to Julia v0.3. That should happen (I believe) with the next point release of v0.3.

@pcmoritz
Copy link
Author

pcmoritz commented Mar 6, 2015

Thank you!

@pcmoritz pcmoritz closed this as completed Mar 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants