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

In a variety of cases, errors in PySeries::scatter mean Python Series.__setitem__ will corrupt the Series #16905

Closed
2 tasks done
itamarst opened this issue Jun 12, 2024 · 0 comments · Fixed by #16930
Closed
2 tasks done
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@itamarst
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

s1 = pl.Series([1, 2, 3])
s1[-200] = 3  # will corrupt the series

s2 = pl.Series([1, 2, 3])
s2[[1, None] = 3  # will corrupt the series

s3 = pl.Series([object()], dtype=pl.Object)
s3[0] = 1  # will corrupt the series

Log output

No response

Issue description

The error handling path in PySeries::scatter() does not reset self.series from an empty state, so the PySeries loses all its data if you hit one of the error paths. This is a problem for exploratory data analysis, or any sort of interactive usage.

This is a spinoff from #15294

Expected behavior

Restore data to previous state, unchanged.

Installed versions

Git as of June 12, 2024.

@itamarst itamarst added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant