Opened 17 years ago
Closed 13 years ago
#7343 closed Bug (worksforme)
django.utils.functional.lazy fails for datetime.date.today
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | lazy functional |
Cc: | nowellpublic@…, simon@…, jwilk@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When attempting to create a lazily evaluated version of datetime.date.today
-- lazy(datetime.date.today, datetime.date)
-- the lazy function returns an error because datetime.date.today
does not have a __dict__
attribute. This used to work with the old version of lazy (my old version was from r4944).
Attachments (1)
Change History (11)
comment:1 by , 17 years ago
Description: | modified (diff) |
---|
comment:2 by , 16 years ago
Triage Stage: | Unreviewed → Someday/Maybe |
---|
by , 16 years ago
Attachment: | django-update_wrapper-attribute_error.diff added |
---|
comment:3 by , 16 years ago
Cc: | added |
---|---|
Has patch: | set |
comment:4 by , 16 years ago
Cc: | added |
---|
comment:5 by , 15 years ago
Cc: | added |
---|
comment:6 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:7 by , 14 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
comment:8 by , 14 years ago
Cc: | removed |
---|
comment:9 by , 13 years ago
Component: | Uncategorized → Core (Other) |
---|---|
Needs tests: | set |
Triage Stage: | Someday/Maybe → Accepted |
UI/UX: | unset |
There's a patch, now we need tests, and a performance benchmark to ensure the impact is limited — see Malcolm's comment.
comment:10 by , 13 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
In current code, this is passing with success:
import datetime lazy_today = lazy(datetime.date.today, datetime.date) self.assertEqual(lazy_today(), datetime.date.today())
Note:
See TracTickets
for help on using tickets.
Since
lazy()
is designed for internal use and the primary use is translation stuff, the recent performance improvements which may have caused this are well worth the trade-off. So if somebody wants to write a patch to handle things like this that does not increase memory usage or impact performance, we'd certainly take it (and I can imagine such a patch would be possible).