diff --git a/src/function.rs b/src/function.rs index bc5b20aa..ce224231 100644 --- a/src/function.rs +++ b/src/function.rs @@ -167,6 +167,7 @@ pub unsafe fn handle_callback(location: &str, f: F) -> *mut ffi::PyObject ret } +#[cfg(feature="nightly")] fn handle_panic(_py: Python, _panic: &any::Any) -> *mut ffi::PyObject { let msg = cstr!("Rust panic"); unsafe { diff --git a/src/py_class/mod.rs b/src/py_class/mod.rs index 5e7f5356..0dfb7e37 100644 --- a/src/py_class/mod.rs +++ b/src/py_class/mod.rs @@ -64,11 +64,20 @@ pub unsafe fn data_init<'a, T>(_py: Python<'a>, obj: &'a PyObject, offset: usize #[inline] #[doc(hidden)] +#[cfg(feature="nightly")] pub unsafe fn data_drop<'a, T>(_py: Python<'a>, obj: *mut ffi::PyObject, offset: usize) { let ptr = (obj as *mut u8).offset(offset as isize) as *mut T; ptr::drop_in_place(ptr) } +#[inline] +#[doc(hidden)] +#[cfg(not(feature="nightly"))] +pub unsafe fn data_drop<'a, T>(_py: Python<'a>, obj: *mut ffi::PyObject, offset: usize) { + let ptr = (obj as *mut u8).offset(offset as isize) as *mut T; + ptr::read(ptr); +} + #[inline] #[doc(hidden)] pub fn is_ready(_py: Python, ty: &ffi::PyTypeObject) -> bool {