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

ExactSizeIterator is a optimization hint but unsafe code cannot trust it #262

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

adamreichold
Copy link
Member

Fixes an instance of PyO3/pyo3#2118 in this package.

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Nice one! Worth mentioning in the CHANGELOG?

@adamreichold adamreichold force-pushed the exact-size-iter-soundness branch from 8e8b62a to 7f7c0d0 Compare January 21, 2022 21:50
@adamreichold
Copy link
Member Author

Nice one! Worth mentioning in the CHANGELOG?

Done.

Fixes an instance of PyO3/pyo3#2118 in this package.

Wording is possibly a bit misleading here. I think this was the only instance in this package. The other usage of ExactSizeIterator at

fn new(strides: impl ExactSizeIterator<Item = npyffi::npy_intp>, type_size: usize) -> Self {
does not seem to have trust issues.

@adamreichold adamreichold merged commit e7b851b into main Jan 21, 2022
@adamreichold adamreichold deleted the exact-size-iter-soundness branch January 21, 2022 21:59
@mejrs
Copy link
Member

mejrs commented Jan 21, 2022

This should have a couple of tests.

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.

3 participants