From 010dd509d7443618a0865cae80003d42b23a1ade Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Sun, 25 Dec 2022 08:45:36 +0000 Subject: [PATCH] pypy: enable `PyList::get_item_unchecked` --- newsfragments/2827.added.md | 1 + src/types/list.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/2827.added.md diff --git a/newsfragments/2827.added.md b/newsfragments/2827.added.md new file mode 100644 index 00000000000..4bd084ae91d --- /dev/null +++ b/newsfragments/2827.added.md @@ -0,0 +1 @@ +Add `PyList::get_item_unchecked` for PyPy. diff --git a/src/types/list.rs b/src/types/list.rs index d81e8153947..2ef7bca8f36 100644 --- a/src/types/list.rs +++ b/src/types/list.rs @@ -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).