From c189bf9bde596fb030c2bdd460aeeb3553f198b2 Mon Sep 17 00:00:00 2001 From: Alexander Buchkovsky Date: Tue, 17 Jan 2017 02:29:02 +0200 Subject: [PATCH 1/5] !B [#7852] fix for _rrule maximum recursion depth exceeded --- lib/matplotlib/dates.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 023fb16fdfa8..192f8c0c7818 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -711,6 +711,9 @@ 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) From 4e08061f639be62795219248c231bbb603a39415 Mon Sep 17 00:00:00 2001 From: Alexander Buchkovsky Date: Thu, 19 Jan 2017 02:02:38 +0200 Subject: [PATCH 2/5] !U add test for rrulewrapper pickling --- lib/matplotlib/tests/test_pickle.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 7d43553b8617..74ef9a34ce4b 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -11,6 +11,7 @@ import numpy as np from matplotlib.testing.decorators import cleanup, image_comparison +from matplotlib.dates import rrulewrapper import matplotlib.pyplot as plt import matplotlib.transforms as mtransforms @@ -270,6 +271,12 @@ def test_transform(): assert_equal(obj.wrapper.output_dims, obj.composite.output_dims) +def test_rrulewrapper(): + r = rrulewrapper(2) + with assert_raises(RecursionError): + pickle.loads(pickle.dumps(r)) + + if __name__ == '__main__': import nose nose.runmodule(argv=['-s']) From 463091150dd137c057236e025f6887346402cf50 Mon Sep 17 00:00:00 2001 From: Alexander Buchkovsky Date: Thu, 19 Jan 2017 03:20:00 +0200 Subject: [PATCH 3/5] !U fix the test to check the error is not raised --- lib/matplotlib/tests/test_pickle.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 74ef9a34ce4b..45e6c4ef0d5d 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -273,9 +273,12 @@ def test_transform(): def test_rrulewrapper(): r = rrulewrapper(2) - with assert_raises(RecursionError): + try: pickle.loads(pickle.dumps(r)) - + except RecursionError: + print('rrulewrapper pickling test failed') + raise + if __name__ == '__main__': import nose From 6bc363b1b11019cc462aa0eb38974d060c7dac5f Mon Sep 17 00:00:00 2001 From: Alexander Buchkovsky Date: Thu, 19 Jan 2017 17:33:58 +0200 Subject: [PATCH 4/5] !U remove the redundant whitespace --- lib/matplotlib/dates.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 192f8c0c7818..45063b835886 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -713,7 +713,6 @@ def set(self, **kwargs): 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) From 17ba26c577f19242a6a90c4f0f4d9c2c4644dfee Mon Sep 17 00:00:00 2001 From: Alexander Buchkovsky Date: Fri, 20 Jan 2017 00:33:32 +0200 Subject: [PATCH 5/5] !U remove redundant whitespaces --- lib/matplotlib/tests/test_pickle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_pickle.py b/lib/matplotlib/tests/test_pickle.py index 45e6c4ef0d5d..52d63c16b19e 100644 --- a/lib/matplotlib/tests/test_pickle.py +++ b/lib/matplotlib/tests/test_pickle.py @@ -278,7 +278,7 @@ def test_rrulewrapper(): except RecursionError: print('rrulewrapper pickling test failed') raise - + if __name__ == '__main__': import nose