parent
b7ecec7812
commit
6f74fe6b38
|
@ -72,10 +72,8 @@ impl PyTuple {
|
||||||
pub fn get_item(&self, index: usize) -> &PyAny {
|
pub fn get_item(&self, index: usize) -> &PyAny {
|
||||||
assert!(index < self.len());
|
assert!(index < self.len());
|
||||||
unsafe {
|
unsafe {
|
||||||
// PyTuple_GET_ITEM return borrowed ptr; must make owned for safety (see #890).
|
self.py()
|
||||||
let ptr = ffi::PyTuple_GET_ITEM(self.as_ptr(), index as Py_ssize_t);
|
.from_borrowed_ptr(ffi::PyTuple_GET_ITEM(self.as_ptr(), index as Py_ssize_t))
|
||||||
ffi::Py_INCREF(ptr);
|
|
||||||
self.py().from_owned_ptr(ptr)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue