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

chore: added check on iterator end position #5129

Merged
merged 6 commits into from
May 28, 2024

Conversation

cliffburdick
Copy link
Contributor

@cliffburdick cliffburdick commented May 20, 2024

Closes #4822

Description

Issue #4822 reported an issue Coverity found with an unchecked iterator in release mode. gcc13 also finds this by default and reports a warning.

Suggested changelog entry:

Avoid a warning by ensuring an iterator end check is included in release mode.

@cliffburdick
Copy link
Contributor Author

As far as I can tell the test that failed has nothing to do with this PR. Can anyone take a look?

@henryiii
Copy link
Collaborator

Wouldn't it possibly be better to turn the assert into a failure that always triggers? Letting it fall through in release mode seems unideal, even though that's what's happening now.

@cliffburdick
Copy link
Contributor Author

Wouldn't it possibly be better to turn the assert into a failure that always triggers? Letting it fall through in release mode seems unideal, even though that's what's happening now.

Hi @henryiii , I refactored it to do what you suggested.

include/pybind11/detail/class.h Outdated Show resolved Hide resolved
include/pybind11/detail/class.h Outdated Show resolved Hide resolved
@cliffburdick cliffburdick requested a review from rwgk May 28, 2024 02:38
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

Thanks!

@henryiii henryiii merged commit a5b9e50 into pybind:master May 28, 2024
82 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label May 28, 2024
@henryiii
Copy link
Collaborator

Thanks for sticking with it!

@cliffburdick cliffburdick deleted the issue_4822 branch May 28, 2024 14:39
@henryiii henryiii changed the title Added check on iterator end position chore: added check on iterator end position Jun 23, 2024
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Jun 26, 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
4 participants