Skip to content

CoW: Set refs properly for non CoW mode #54118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 17, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Jul 13, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@@ -815,6 +811,9 @@ def swapaxes(self, axis1: Axis, axis2: Axis, copy: bool_t | None = None) -> Self
new_mgr.blocks[0].refs.add_reference(
new_mgr.blocks[0] # type: ignore[arg-type]
)
if not using_copy_on_write() and copy is not False:
new_mgr = new_mgr.copy(deep=True)

return self._constructor(new_mgr).__finalize__(self, method="swapaxes")

elif (copy or copy is None) and self._mgr.is_single_block:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this elif block be removed then? (that is covered by the copy is not False case you added a few lines above)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep thx for noticing

@phofl phofl added this to the 2.1 milestone Jul 17, 2023
@phofl phofl merged commit 6dbc455 into pandas-dev:main Jul 17, 2023
@phofl phofl deleted the cow_set_refs_for_non_cow_mode branch July 17, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants