Skip to content
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

DEPR: Raise FutureWarning about raising an error in __array__ when copy=False cannot be honored #60395

Draft
wants to merge 1 commit into
base: 2.3.x
Choose a base branch
from

Conversation

KevsterAmp
Copy link
Contributor

@KevsterAmp KevsterAmp changed the base branch from main to 2.3.x November 22, 2024 13:44
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Thanks, looking good!

If you remove the error, you will have to update some tests that are now checking for an error (change that to check for a warning, with tm.assert_produces_warning)

And see the issue for a suggestion to expand the message.

Comment on lines +666 to +668
import warnings

from pandas.util._exceptions import find_stack_level
Copy link
Member

Choose a reason for hiding this comment

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

You can move those warnings to the top of the file

"raise an error when a zero-copy numpy array is not possible",
FutureWarning,
stacklevel=find_stack_level(),
)
# TODO: By using `zero_copy_only` it may be possible to implement this
raise ValueError(
Copy link
Member

Choose a reason for hiding this comment

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

This error should then be removed (we are adding the warning instead of the error, to warn people it will error in the future).

Comment on lines +1675 to +1677
import warnings

from pandas.util._exceptions import find_stack_level
Copy link
Member

Choose a reason for hiding this comment

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

Same here about the imports (and similar for next cases)

"raise an error when a zero-copy numpy array is not possible",
FutureWarning,
stacklevel=find_stack_level(),
)
raise ValueError(
Copy link
Member

Choose a reason for hiding this comment

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

And same for the errors

@jorisvandenbossche jorisvandenbossche added this to the 2.3 milestone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEPR: deprecate / warn about raising an error in __array__ when copy=False cannot be honore
2 participants