Skip to content

Commit 2f755ae

Browse files
committed
add comment
1 parent 553ef54 commit 2f755ae

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/types/dict.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ impl DictIterImpl {
518518
1 => unsafe { key.assume_owned_unchecked(py) },
519519
x => panic!("Unknown return value from PyIter_NextItem: {}", x),
520520
};
521+
// get_item can only fail if another thread concurrently
522+
// removed the key, so we know that remaining definitely
523+
// needs to be decremented no matter what.
521524
*remaining -= 1;
522525
let value = match dict.get_item(&key) {
523526
Ok(value) => value?,

0 commit comments

Comments
 (0)