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
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature="nightly")]
|
||||||
fn handle_panic(_py: Python, _panic: &any::Any) -> *mut ffi::PyObject {
|
fn handle_panic(_py: Python, _panic: &any::Any) -> *mut ffi::PyObject {
|
||||||
let msg = cstr!("Rust panic");
|
let msg = cstr!("Rust panic");
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -64,11 +64,20 @@ pub unsafe fn data_init<'a, T>(_py: Python<'a>, obj: &'a PyObject, offset: usize
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
#[cfg(feature="nightly")]
|
||||||
pub unsafe fn data_drop<'a, T>(_py: Python<'a>, obj: *mut ffi::PyObject, offset: usize) {
|
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;
|
let ptr = (obj as *mut u8).offset(offset as isize) as *mut T;
|
||||||
ptr::drop_in_place(ptr)
|
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]
|
#[inline]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn is_ready(_py: Python, ty: &ffi::PyTypeObject) -> bool {
|
pub fn is_ready(_py: Python, ty: &ffi::PyTypeObject) -> bool {
|
||||||
|
|
Loading…
Reference in New Issue