Permalink
Browse files

Refs #28389 -- Added release note and test for pickling of LazyObject…

… when wrapped object doesn't have __reduce__().

Forwardport of 30f334c from stable/1.11.x
  • Loading branch information...
sir-sigurd authored and timgraham committed Jul 12, 2017
1 parent 59a4b12 commit 83440a1258ab2e0c29ce2c5d3586456ece20b633
Showing with 5 additions and 0 deletions.
  1. +3 −0 docs/releases/1.11.4.txt
  2. +2 −0 tests/utils_tests/test_lazyobject.py
View
@@ -15,3 +15,6 @@ Bugfixes
* Fixed ``QuerySet.union()`` and ``difference()`` when combining with
a queryset raising ``EmptyResultSet`` (:ticket:`28378`).
+
+* Fixed a regression in pickling of ``LazyObject`` on Python 2 when the wrapped
+ object doesn't have ``__reduce__()`` (:ticket:`28389`).
@@ -184,11 +184,13 @@ def __iter__(self):
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

0 comments on commit 83440a1

Please sign in to comment.