Skip to content

Commit

Permalink
Remove use of get_item. Revise changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen-CH-Leung committed Jan 16, 2025
1 parent 7751a1c commit a735850
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion newsfragments/4810.added.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Optimizes `nth` and `nth_back` for `BoundListIterator`
Optimizes `nth`, `nth_back`, `advance_by` and `advance_back_by` for `BoundListIterator`
8 changes: 4 additions & 4 deletions src/types/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ impl<'py> BoundListIterator<'py> {
}

#[inline]
#[cfg(all(not(Py_LIMITED_API), not(feature = "nightly")))]
#[cfg(not(feature = "nightly"))]
fn nth(
index: &mut Index,
length: &mut Length,
Expand Down Expand Up @@ -619,7 +619,7 @@ impl<'py> BoundListIterator<'py> {
}

#[inline]
#[cfg(all(not(Py_LIMITED_API), not(feature = "nightly")))]
#[cfg(not(feature = "nightly"))]
fn nth_back(
index: &mut Index,
length: &mut Length,
Expand Down Expand Up @@ -684,7 +684,7 @@ impl<'py> Iterator for BoundListIterator<'py> {
}

#[inline]
#[cfg(all(not(Py_LIMITED_API), not(feature = "nightly")))]
#[cfg(not(feature = "nightly"))]
fn nth(&mut self, n: usize) -> Option<Self::Item> {
self.with_critical_section(|index, length, list| Self::nth(index, length, list, n))
}
Expand Down Expand Up @@ -863,7 +863,7 @@ impl DoubleEndedIterator for BoundListIterator<'_> {
}

#[inline]
#[cfg(all(not(Py_LIMITED_API), not(feature = "nightly")))]
#[cfg(not(feature = "nightly"))]
fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
self.with_critical_section(|index, length, list| Self::nth_back(index, length, list, n))
}
Expand Down

0 comments on commit a735850

Please sign in to comment.