Opened 13 years ago
Closed 13 years ago
#18175 closed Bug (fixed)
SortedDict issue when copied with copy.copy
Reported by: | linovia | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | linovia | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If SortedDict is copied using the copy.copy, the data are duplicated.
>>> from django.utils.datastructures import SortedDict >>> from copy import copy >>> test = SortedDict() >>> test['a']=1 >>> copy(test) {'a': 1, 'a': 1} >>> test {'a': 1, 'a': 1}
You'll find joined a test patch to show this issue.
Attachments (3)
Change History (6)
by , 13 years ago
Attachment: | failing_sorted_dict_test.diff added |
---|
by , 13 years ago
Attachment: | sorted_dict_copy.diff added |
---|
comment:2 by , 13 years ago
Can you explain what is going wrong currently? Why that __copy__
method is needed? Preferably in a comment included in the patch.
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Triage Stage: | Unreviewed → Accepted |
Fixed in commit 4b11762f7d7aed2f4f36c4158326c0a4332038f9
I did some small changes to the patch. I still don't understand why the behavior was broken before.
Thanks for the report & patch!
Note:
See TracTickets
for help on using tickets.
Failing test case