Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,10 @@ def __deepcopy__(self, memo=None):
Return a deepcopy of the `Path`. The `Path` will not be
readonly, even if the source `Path` is.
"""
try:
codes = self.codes.copy()
except AttributeError:
codes = None
return self.__class__(
self.vertices.copy(), codes,
_interpolation_steps=self._interpolation_steps)
# Deepcopying arrays (vertices, codes) strips the writeable=False flag.
p = copy.deepcopy(super(), memo)
p._readonly = False
return p

deepcopy = __deepcopy__

Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_textpath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import copy

from matplotlib.textpath import TextPath


def test_copy():
tp = TextPath((0, 0), ".")
assert copy.deepcopy(tp).vertices is not tp.vertices
assert (copy.deepcopy(tp).vertices == tp.vertices).all()
assert copy.copy(tp).vertices is tp.vertices