pypy: enable PyList::get_item_unchecked

This commit is contained in:
David Hewitt 2022-12-25 08:45:36 +00:00
parent 0f70fc6e0c
commit 010dd509d7
2 changed files with 2 additions and 1 deletions

View file

@ -0,0 +1 @@
Add `PyList::get_item_unchecked` for PyPy.

View file

@ -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).