Skip to content

Cannot pickle a plot result if use tight_layout method (plot with datetime objects) #8273

Closed
@bondarevts

Description

@bondarevts

Bug report

Bug summary

Cannot pickle a plot result if use tight_layout method on the plot with datetime objects.

Code for reproduction

import matplotlib.pyplot as plt
import pickle
from datetime import datetime

plot = plt.plot([datetime(1900, 1, 1), datetime(1900, 1, 2)], [1, 2])
plt.gcf().tight_layout()

dump = pickle.dumps(plot)
pickle.loads(dump)

Actual outcome

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/user/miniconda3/lib/python3.5/site-packages/matplotlib/dates.py", line 719, in __getattr__
    return getattr(self._rrule, name)

 ...

  File "/Users/user/miniconda3/lib/python3.5/site-packages/matplotlib/dates.py", line 719, in __getattr__
    return getattr(self._rrule, name)
RecursionError: maximum recursion depth exceeded while calling a Python object

Expected outcome

I expect to have a copy of the plot object.

Matplotlib version

matplotlib v.2.0.0 with Python 3.5.2 installed with conda on linux.

>>> import sys; print(sys.version)
3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions