Remove #[feature(unsafe_no_drop_flag)]: it's no longer necessary with the latest nightlies.

Warning: to use rust-cpython with --feature nightly, you now must use 'rustc 1.13.0-nightly (e9bc1bac8 2016-08-24)' or newer; or you'll get segfaults due to the drop flags.
Use of rust-cpython with stable rust is not affected.
This commit is contained in:
Daniel Grunwald 2016-08-25 21:22:18 +02:00
parent 227c0a6e41
commit 1129131501
2 changed files with 2 additions and 19 deletions

View file

@ -17,17 +17,14 @@
// DEALINGS IN THE SOFTWARE.
#![cfg_attr(feature="nightly", feature(
unsafe_no_drop_flag, filling_drop, // (#5016)
// ^ These two are crucial so that `PyObject` is binary compatible with
// `*mut ffi::PyObject`, which we use for efficient slice access and in
// some other cases.
const_fn, // for GILProtected::new (#24111)
shared, // for std::ptr::Shared (#27730)
//recover, // for converting panics to python exceptions (#27719)
// -- TODO wait for stable release and promote recover code from cfg(nightly) (1.9?)
// -- TODO remove <DUMMY> hack when it's no longer necessary on stable (1.9?)
// -- TODO make stuff depending on mem::size_of::<PyObject>() == mem::size_of::<*mut ffi::PyObject>()
// available without cfg(nightly) (#5016, Rust 1.13?)
))]
#![allow(unused_imports)] // because some imports are only necessary with python 2.x or 3.x

View file

@ -42,7 +42,6 @@ use err::PyResult;
/// on `PyObject` to convert to more specific object types.
///
/// Most of the interesting methods are provided by the [ObjectProtocol trait](trait.ObjectProtocol.html).
#[cfg_attr(feature="nightly", unsafe_no_drop_flag)]
#[cfg_attr(feature="nightly", repr(C))]
pub struct PyObject {
// PyObject owns one reference to the *PyObject
@ -59,23 +58,10 @@ unsafe impl Sync for PyObject {}
/// Dropping a `PyObject` decrements the reference count on the object by 1.
impl Drop for PyObject {
#[inline]
#[cfg(feature="nightly")]
fn drop(&mut self) {
// TODO: remove `if` when #[unsafe_no_drop_flag] disappears
if unpack_shared(self.ptr) as usize != mem::POST_DROP_USIZE {
let _gil_guard = Python::acquire_gil();
unsafe { ffi::Py_DECREF(unpack_shared(self.ptr)); }
}
}
#[inline]
#[cfg(not(feature="nightly"))]
fn drop(&mut self) {
let _gil_guard = Python::acquire_gil();
unsafe { ffi::Py_DECREF(unpack_shared(self.ptr)); }
}
}
#[inline]