id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 20212 Error pickling SimpleLazyObject Iru Hwang daniellindsley "Pickling SimpleLazyObject doesn't seem to work. I've noticed that new classmethod ""__newobj__"" is added in 1.5 but seems it prevents the object from pickling. This affects some cases when request.user needs to be pickled. {{{ >>> from django.utils.functional import SimpleLazyObject >>> from django.contrib.auth.models import User >>> u = User.objects.all()[0] >>> s = SimpleLazyObject(lambda: u) >>> import pickle >>> pickle.dumps(s) Traceback (most recent call last): File """", line 1, in File ""/usr/lib/python2.7/pickle.py"", line 1374, in dumps Pickler(file, protocol).dump(obj) File ""/usr/lib/python2.7/pickle.py"", line 224, in dump self.save(obj) File ""/usr/lib/python2.7/pickle.py"", line 331, in save self.save_reduce(obj=obj, *rv) File ""/usr/lib/python2.7/pickle.py"", line 400, in save_reduce save(func) File ""/usr/lib/python2.7/pickle.py"", line 306, in save rv = reduce(self.proto) File ""/usr/lib/python2.7/copy_reg.py"", line 70, in _reduce_ex raise TypeError, ""can't pickle %s objects"" % base.__name__ TypeError: can't pickle instancemethod objects >>> }}}" Bug closed Core (Serialization) 1.5 Release blocker fixed iru@… bmispelon@… daniellindsley Accepted 1 0 1 1 0 0