Opened 8 years ago

Closed 5 years ago

#7343 closed Bug (worksforme)

django.utils.functional.lazy fails for

Reported by: anonymous Owned by: nobody
Component: Core (Other) Version: master
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 Ramiro Morales)

When attempting to create a lazily evaluated version of -- lazy(, -- the lazy function returns an error because does not have a __dict__ attribute. This used to work with the old version of lazy (my old version was from r4944).

Attachments (1)

django-update_wrapper-attribute_error.diff (624 bytes) - added by Jakub Wilk <ubanus@…> 8 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by Ramiro Morales

Description: modified (diff)

comment:2 Changed 8 years ago by Malcolm Tredinnick

Triage Stage: UnreviewedSomeday/Maybe

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).

Changed 8 years ago by Jakub Wilk <ubanus@…>

comment:3 Changed 8 years ago by Jakub Wilk <ubanus@…>

Cc: ubanus@… added
Has patch: set

comment:4 Changed 8 years ago by Nowell Strite

Cc: nowellpublic@… added

comment:5 Changed 7 years ago by Simon Law

Cc: simon@… added

comment:6 Changed 6 years ago by Luke Plant

Severity: Normal
Type: Bug

comment:7 Changed 6 years ago by Jakub Wilk

Cc: jwilk@… added
Easy pickings: unset

comment:8 Changed 6 years ago by ubanus@…

Cc: ubanus@… removed

comment:9 Changed 5 years ago by Aymeric Augustin

Component: UncategorizedCore (Other)
Needs tests: set
Triage Stage: Someday/MaybeAccepted
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 Changed 5 years ago by Claude Paroz

Resolution: worksforme
Status: newclosed

In current code, this is passing with success:

    import datetime
    lazy_today = lazy(,
Note: See TracTickets for help on using tickets.
Back to Top