Skip to content

Commit

Permalink
Merge #2827
Browse files Browse the repository at this point in the history
2827: pypy: enable `PyList::get_item_unchecked` r=davidhewitt a=davidhewitt

Split out from #2826. Approved previously as part of that review.

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
  • Loading branch information
bors[bot] and davidhewitt committed Dec 25, 2022
2 parents 0f70fc6 + 010dd50 commit 1d5426c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions newsfragments/2827.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `PyList::get_item_unchecked` for PyPy.
2 changes: 1 addition & 1 deletion src/types/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl PyList {
/// # Safety
///
/// Caller must verify that the index is within the bounds of the list.
#[cfg(not(any(Py_LIMITED_API, PyPy)))]
#[cfg(not(Py_LIMITED_API))]
pub unsafe fn get_item_unchecked(&self, index: usize) -> &PyAny {
let item = ffi::PyList_GET_ITEM(self.as_ptr(), index as Py_ssize_t);
// PyList_GET_ITEM return borrowed ptr; must make owned for safety (see #890).
Expand Down

0 comments on commit 1d5426c

Please sign in to comment.