Skip to content

Commit 0505585

Browse files
QuLogicbcongdon
authored andcommitted
Don't pickle Axes' cached renderer.
It's not allowed to be pickled on a Figure, so presumably it shouldn't be allowed on the Axes either. Fixes matplotlib#6870. Fixes matplotlib#6181. Fixes matplotlib#3899.
1 parent 689cd65 commit 0505585

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎lib/matplotlib/axes/_base.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,13 @@ def __init__(self, fig, rect,
579579
right=rcParams['ytick.right'] and rcParams['ytick.major.right'],
580580
which='major')
581581

582+
def __getstate__(self):
583+
# The renderer should be re-created by the figure, and then cached at
584+
# that point.
585+
state = super(_AxesBase, self).__getstate__()
586+
state['_cachedRenderer'] = None
587+
return state
588+
582589
def __setstate__(self, state):
583590
self.__dict__ = state
584591
# put the _remove_method back on all artists contained within the axes

0 commit comments

Comments
 (0)