-
Notifications
You must be signed in to change notification settings - Fork 923
Handle errors on PyIterator when calling size_hint
#5604
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
Conversation
827a752 to
4129275
Compare
9fe9a61 to
ae20ab2
Compare
davidhewitt
left a comment
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
222389a to
8c5d609
Compare
8c5d609 to
d9de53e
Compare
30831fb to
a5576aa
Compare
davidhewitt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
fixes #5595