File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -272,13 +272,10 @@ def __deepcopy__(self, memo=None):
272272 Return a deepcopy of the `Path`. The `Path` will not be
273273 readonly, even if the source `Path` is.
274274 """
275- try :
276- codes = self .codes .copy ()
277- except AttributeError :
278- codes = None
279- return self .__class__ (
280- self .vertices .copy (), codes ,
281- _interpolation_steps = self ._interpolation_steps )
275+ # Deepcopying arrays (vertices, codes) strips the writeable=False flag.
276+ p = copy .deepcopy (super (), memo )
277+ p ._readonly = False
278+ return p
282279
283280 deepcopy = __deepcopy__
284281
Original file line number Diff line number Diff line change 1+ import copy
2+
3+ from matplotlib .textpath import TextPath
4+
5+
6+ def test_copy ():
7+ tp = TextPath ((0 , 0 ), "." )
8+ assert copy .deepcopy (tp ).vertices is not tp .vertices
9+ assert (copy .deepcopy (tp ).vertices == tp .vertices ).all ()
10+ assert copy .copy (tp ).vertices is tp .vertices
You can’t perform that action at this time.
0 commit comments