Cleaned up some __getstate__() docstrings.

This commit is contained in:
Tim Graham 2016-11-23 09:45:21 -05:00
parent b63d0c54b0
commit 2e5fbe889f
3 changed files with 8 additions and 12 deletions

View file

@ -300,11 +300,12 @@ class LazyObject(object):
self._setup()
return (unpickle_lazyobject, (self._wrapped,))
# We have to explicitly override __getstate__ so that older versions of
# pickle don't try to pickle the __dict__ (which in the case of a
# SimpleLazyObject may contain a lambda). The value will end up being
# ignored by our __reduce__ and custom unpickler.
def __getstate__(self):
"""
Prevent older versions of pickle from trying to pickle the __dict__
(which in the case of a SimpleLazyObject may contain a lambda). The
value will be ignored by __reduce__() and the custom unpickler.
"""
return {}
def __copy__(self):