pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.08k stars 2.05k forks source link

chore: added check on iterator end position #5129

Closed cliffburdick closed 1 month ago

cliffburdick commented 1 month ago

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 commented 1 month ago

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

henryiii commented 1 month ago

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 commented 1 month ago

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.

henryiii commented 1 month ago

Thanks for sticking with it!