Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Fix TransformNode.__copy__
without calling copy.copy
  • Loading branch information
jkseppan committed Jun 25, 2025
commit 5c7c91542127adf03fa2f401dcb1d3c38b9a9a9c
5 changes: 3 additions & 2 deletions lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
# `np.minimum` instead of the builtin `min`, and likewise for `max`. This is
# done so that `nan`s are propagated, instead of being silently dropped.

import copy
import functools
import itertools
import textwrap
Expand Down Expand Up @@ -139,7 +138,9 @@ def __setstate__(self, data_dict):
for k, v in self._parents.items() if v is not None}

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