Skip to content

Commit 56c8c2b

Browse files
committed
Provide new object for copy routines requiring info. on its destination.
1 parent 61aba59 commit 56c8c2b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6115,7 +6115,7 @@ def __finalize__(self, other, method: str | None = None, **kwargs) -> Self:
61156115
# We provide the new dataset via the deepcopy memo to properly
61166116
# supply eventual attribute copy routines requiring information
61176117
# from its destination
6118-
self.attrs = deepcopy(other.attrs, memo={object:self})
6118+
self.attrs = deepcopy(other.attrs, memo={object():self})
61196119
self.flags.allows_duplicate_labels = (
61206120
self.flags.allows_duplicate_labels
61216121
and other.flags.allows_duplicate_labels
@@ -6133,7 +6133,7 @@ def __finalize__(self, other, method: str | None = None, **kwargs) -> Self:
61336133
attrs = objs[0].attrs
61346134
have_same_attrs = all(obj.attrs == attrs for obj in objs[1:])
61356135
if have_same_attrs:
6136-
self.attrs = deepcopy(attrs)
6136+
self.attrs = deepcopy(attrs, memo={object():self})
61376137

61386138
allows_duplicate_labels = all(x.flags.allows_duplicate_labels for x in objs)
61396139
self.flags.allows_duplicate_labels = allows_duplicate_labels

0 commit comments

Comments
 (0)