-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(python)!: Introduce CopyNotAllowedError
#14350
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
Conversation
I saw the other issue about this regarding re-chunking in place, and I agree that the If I had to boil down all of the possibilities when performing something like
|
I think you misunderstood what I was trying to say. We will always try to do things without copying. Sometimes the user wants to be certain no copy will happen, which is what the parameter is for. And for the case where the user wants to be certain they have a writable result, they can use the other parameter |
CopyNotAllowedError
CopyNotAllowedError
84fe575
to
f683875
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #14350 +/- ##
==========================================
- Coverage 80.93% 80.93% -0.01%
==========================================
Files 1325 1325
Lines 171960 171961 +1
Branches 2452 2452
==========================================
- Hits 139184 139175 -9
- Misses 32305 32315 +10
Partials 471 471 ☔ View full report in Codecov by Sentry. |
Maybe call it CopyRequiredError or CopyUnavoidableError. |
|
This approach no longer works since the errors are now raised from Rust. Unfortunately, our Rust exceptions cannot subclass multiple exceptions - I would like I'll close this for now, perhaps we can solve this nicely in the future when exception hierarchies are supported in PyO3 with the For now, these will raise a |
Ref #14334
This error already existed in the interchange protocol. I am making it a proper Polars error so we can re-use it in our various interop methods.
I updated
Series.to_numpy
using this error & improved the error messages. Example:This is breaking because
Series.to_numpy
currently raises aValueError
on copy.I am open to some bikeshedding on the name of the new error type.