Fix build with stable Rust.
This commit is contained in:
parent
b43fa55e01
commit
e608d5eabe
|
@ -167,6 +167,7 @@ pub unsafe fn handle_callback<F, T>(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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue