Skip to content

Commit ed4c77f

Browse files
author
Mayank
committed
CoW: preserve refs.referenced_blocks list identity during cleanup to avoid breaking external references (GH#62787)
1 parent 7c49240 commit ed4c77f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/core/internals/blocks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,8 @@ def replace_list(
877877
if id(obj) in to_remove_ids:
878878
continue
879879
new_refs.append(wr)
880-
self.refs.referenced_blocks = new_refs
880+
# Preserve list identity to avoid breaking external references
881+
self.refs.referenced_blocks[:] = new_refs
881882
# For blocks that have already copied, clear their refs to avoid
882883
# future copies.
883884
for blk in result:

0 commit comments

Comments
 (0)