Skip to content

FIX: add __setstate__ function #8287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
FIX: add __setstate__ function
To prevent an infinite recursion add a __setstate__ method
so that we do not consult `_rrule` before it exists
  • Loading branch information
tacaswell committed Mar 13, 2017
commit eb98d0766cd12a64dfc33faeedc988582565a07b
5 changes: 3 additions & 2 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,12 +711,13 @@ def set(self, **kwargs):
self._rrule = rrule(**self._construct)

def __getattr__(self, name):
if name in ['__getstate__', '__setstate__']:
return object.__getattr__(self, name)
if name in self.__dict__:
return self.__dict__[name]
return getattr(self._rrule, name)

def __setstate__(self, state):
self.__dict__.update(state)


class DateLocator(ticker.Locator):
"""
Expand Down