Opened 14 years ago
Closed 12 years ago
#15811 closed Bug (fixed)
Lazy doesn't take into account methods defined in parents
Reported by: | Amirouche | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Amirouche | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Example:
from django.utils.datastructures import SortedDict from django.utils.functional import lazy def a(): return SortedDict([(2,2),(1,1)]) f = lazy(a, SortedDict)() f[1]
This results in a TypeError
I got a patch ready but not sure if it does what it should do well since I don't grasp all the lazy
functionality.
Attachments (4)
Change History (12)
by , 14 years ago
Attachment: | deep_lazy.diff added |
---|
comment:1 by , 14 years ago
Version: | 1.2 → SVN |
---|
comment:2 by , 14 years ago
Has patch: | set |
---|---|
Type: | Uncategorized → Bug |
comment:3 by , 14 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Easy pickings: | unset |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
'deep copy' is confusing terminology - it normally refers to copy.deepcopy
. What you are referring to is checking base class methods. The test name and comments need to be updated accordingly.
In addition, I think that test should not implicitly rely on the fact that SortedDict doesn't have __getitem__
defined - that could easily change. I would define a pair of custom classes that show the problem, probably within the test method itself.
Otherwise, this looks pretty good.
comment:5 by , 14 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Thanks!
For future reference, when you have updated a patch, you should uncheck the 'Patch needs improvement' flag if you think the patch is up to scratch. A reviewer will set it again if it isn't.
comment:7 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
UI/UX: | unset |
new patch which avoids using double underscores.
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
It's not at all obvious to me that this new patch does the same as the existing code, especially given the rather vague definition of 'dir': "return an alphabetized list of names comprising (some of) the attributes of the given object, and of attributes reachable from it."
So I'm closing again. Since the original bug is fixed, please open a new ticket or pull request for any cleanup.
patch that deeply "copy" a class methods