Skip to content

Conversation

@bschoenmaeckers
Copy link
Member

fixes #5595

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.

Thanks for handling!

fn test_size_hint(obj: &crate::Bound<'_, crate::PyAny>) {
let iter = obj.cast::<PyIterator>().unwrap();
assert_eq!((0, None), iter.size_hint());
assert!(PyErr::take(obj.py()).is_none());
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps use UnraisableCapture to demonstrate that the error was sent to sys.unraisablehook?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Did not know yet about this utility.

@bschoenmaeckers bschoenmaeckers force-pushed the iter_size_hint_error branch 2 times, most recently from 222389a to 8c5d609 Compare November 10, 2025 12:48
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.

Thanks!

@davidhewitt davidhewitt added this pull request to the merge queue Nov 11, 2025
Merged via the queue into PyO3:main with commit 8b9be05 Nov 11, 2025
41 of 42 checks passed
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.

size_hint implementation in Bound<'py, PyIterator> looks suspect

2 participants