Regression in pickling LazyObject on Python 2 if wrapped object doesn't have __reduce__()
In [126]: import pickle
In [127]: from django.utils.functional import LazyObject
In [128]: class A(object):
...: pass
...:
In [129]: lazy_obj = LazyObject()
In [130]: a = A()
In [131]: a.foo = 'bar'
In [132]: lazy_obj._wrapped = a
In [133]: pickle.loads(pickle.dumps(lazy_obj)).foo
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-133-a85d49df8170> in <module>()
----> 1 pickle.loads(pickle.dumps(lazy_obj)).foo
AttributeError: 'A' object has no attribute 'foo'
Introduced in 35355a4ffedb2aeed52d5fe3034380ffc6a438db.
Change History
(5)
Owner: |
changed from nobody to Sergey Fedoseev
|
Status: |
new → assigned
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Summary: |
pickling LazyObject works incorrectly on Python 2 → Regression in pickling LazyObject on Python 2 if wrapped object doesn't have __reduce__()
|
Triage Stage: |
Unreviewed → Ready for checkin
|
PR