python2 compatibility
This commit is contained in:
parent
b738c1a04b
commit
3681cf51e8
|
@ -2,6 +2,7 @@ Changes
|
|||
-------
|
||||
|
||||
0.2.4 (2018-01-19)
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* Allow to get mutable ref from PyObject #106
|
||||
|
||||
|
|
|
@ -48,10 +48,12 @@ impl<T> PyBufferProtocolImpl for T {
|
|||
impl<'p, T> PyBufferProtocolImpl for T where T: PyBufferProtocol<'p>
|
||||
{
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(needless_update))]
|
||||
fn tp_as_buffer() -> Option<ffi::PyBufferProcs> {
|
||||
Some(ffi::PyBufferProcs{
|
||||
bf_getbuffer: Self::cb_bf_getbuffer(),
|
||||
bf_releasebuffer: None,
|
||||
.. ffi::PyBufferProcs_INIT
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ impl<'p> Python<'p> {
|
|||
/// Release `ffi::PyObject` pointer.
|
||||
/// Undefined behavior if the pointer is invalid.
|
||||
#[inline]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(not_unsafe_ptr_arg_deref))]
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(not_unsafe_ptr_arg_deref))]
|
||||
pub fn xdecref(self, ptr: *mut ffi::PyObject) {
|
||||
if !ptr.is_null() {
|
||||
unsafe {ffi::Py_DECREF(ptr)};
|
||||
|
|
Loading…
Reference in a new issue