-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CoW: Warn for cases that go through putmask #56168
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
Changes from 2 commits
9b30bdd
8585bd7
cad8aad
4aa030a
4459b86
b5992b3
9dee585
f278753
b02626e
c09a5f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,16 @@ | |
from pandas.tests.copy_view.util import get_array | ||
|
||
|
||
def test_clip_inplace_reference(using_copy_on_write): | ||
def test_clip_inplace_reference(using_copy_on_write, warn_copy_on_write): | ||
df = DataFrame({"a": [1.5, 2, 3]}) | ||
df_copy = df.copy() | ||
arr_a = get_array(df, "a") | ||
view = df[:] | ||
df.clip(lower=2, inplace=True) | ||
if warn_copy_on_write: | ||
with tm.assert_cow_warning(): | ||
df.clip(lower=2, inplace=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this ideally give a more specific warning about an inplace method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure we can change the message |
||
else: | ||
df.clip(lower=2, inplace=True) | ||
|
||
if using_copy_on_write: | ||
assert not np.shares_memory(get_array(df, "a"), arr_a) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a small comment here about why such a class is needed (in contrast to a simple boolean argument)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added