Skip to content

Commit 5c7c915

Browse files
committed
Fix TransformNode.__copy__
without calling copy.copy
1 parent b20cf20 commit 5c7c915

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/transforms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# `np.minimum` instead of the builtin `min`, and likewise for `max`. This is
3636
# done so that `nan`s are propagated, instead of being silently dropped.
3737

38-
import copy
3938
import functools
4039
import itertools
4140
import textwrap
@@ -139,7 +138,9 @@ def __setstate__(self, data_dict):
139138
for k, v in self._parents.items() if v is not None}
140139

141140
def __copy__(self):
142-
other = copy.copy(super())
141+
cls = type(self)
142+
other = cls.__new__(cls)
143+
other.__dict__.update(self.__dict__)
143144
# If `c = a + b; a1 = copy(a)`, then modifications to `a1` do not
144145
# propagate back to `c`, i.e. we need to clear the parents of `a1`.
145146
other._parents = {}

0 commit comments

Comments
 (0)