Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
Simplify
  • Loading branch information
phofl committed Feb 9, 2023
commit 254de7d73d40fe4a9321bb0abae29ed9264135ce
1 change: 1 addition & 0 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1944,6 +1944,7 @@ def using_copy_on_write() -> bool:
"""
Fixture to check if Copy-on-Write is enabled.
"""
pd.options.mode.copy_on_write = True
return pd.options.mode.copy_on_write and pd.options.mode.data_manager == "block"


Expand Down
3 changes: 1 addition & 2 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,8 @@ def _maybe_downcast(
# but ATM it breaks too much existing code.
# split and convert the blocks

copy = True if not using_cow else False
return extend_blocks(
[blk.convert(using_cow=using_cow, copy=copy) for blk in blocks]
[blk.convert(using_cow=using_cow, copy=not using_cow) for blk in blocks]
)

if downcast is None:
Expand Down