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

fix: Remove incorrect unsafe pointer cast for int -> enum #15740

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

reswqa
Copy link
Collaborator

@reswqa reswqa commented Apr 18, 2024

This fixes #15738.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Apr 18, 2024
@@ -136,9 +136,6 @@ where
polars_bail!(OutOfBounds: "index {} is bigger than the number of categories {}",m,categories.len());
}
}
// SAFETY:
// we are guarded by the type system
let ca = unsafe { &*(self as *const ChunkedArray<T> as *const UInt32Chunked) };
Copy link
Collaborator Author

@reswqa reswqa Apr 18, 2024

Choose a reason for hiding this comment

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

Self is not always UInt32Chunked, this line is really evil and useless indeed. 😨

Copy link
Member

Choose a reason for hiding this comment

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

Yes, L114 makes this line unsound. 🤔

@reswqa reswqa marked this pull request as ready for review April 18, 2024 13:03
@ritchie46 ritchie46 merged commit 96e1f01 into pola-rs:main Apr 18, 2024
24 checks passed
@reswqa reswqa deleted the cat_unsafe branch April 18, 2024 13:29
Copy link

codspeed-hq bot commented Apr 18, 2024

CodSpeed Performance Report

Merging #15740 will not alter performance

Comparing reswqa:cat_unsafe (1b6b256) with main (2e9674e)

Summary

✅ 22 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pl.Enum Bug / Incorrect and Kernel crashed
2 participants