1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

[1.11.x] Fixed #28389 -- Fixed pickling of LazyObject on Python 2 when wrapped object doesn't have __reduce__().

Partial revert of 35355a4ffe.
This commit is contained in:
Sergey Fedoseev
2017-07-12 15:18:49 +05:00
committed by Tim Graham
parent fe7b456825
commit 30f334cc58
3 changed files with 12 additions and 6 deletions

View File

@@ -187,11 +187,13 @@ class LazyObjectTestCase(TestCase):
def test_pickle(self):
# See ticket #16563
obj = self.lazy_wrap(Foo())
obj.bar = 'baz'
pickled = pickle.dumps(obj)
unpickled = pickle.loads(pickled)
self.assertIsInstance(unpickled, Foo)
self.assertEqual(unpickled, obj)
self.assertEqual(unpickled.foo, obj.foo)
self.assertEqual(unpickled.bar, obj.bar)
# Test copying lazy objects wrapping both builtin types and user-defined
# classes since a lot of the relevant code does __dict__ manipulation and