Skip to content

Commit d32f1c7

Browse files
JRRudy1davidhewitt
authored andcommitted
Added PyClone impl for PyObject.
This is the motivating impl for the changes, since `PyObject` can only be safely cloned while the GIL is held.
1 parent 8e25d8c commit d32f1c7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/dtype.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,13 @@ impl_element_scalar!(Complex64 => NPY_CDOUBLE,
883883
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
884884
impl_element_scalar!(usize, isize);
885885

886+
impl PyClone for PyObject {
887+
#[inline]
888+
fn py_clone(&self, py: Python<'_>) -> Self {
889+
self.clone_ref(py)
890+
}
891+
}
892+
886893
unsafe impl Element for PyObject {
887894
const IS_COPY: bool = false;
888895

0 commit comments

Comments
 (0)