feature gate deprecated APIs for `PyBuffer` (#4144)
This commit is contained in:
parent
dc9a41521a
commit
5534a7bee8
|
@ -18,8 +18,10 @@
|
|||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
//! `PyBuffer` implementation
|
||||
use crate::Bound;
|
||||
#[cfg(feature = "gil-refs")]
|
||||
use crate::PyNativeType;
|
||||
use crate::{err, exceptions::PyBufferError, ffi, FromPyObject, PyAny, PyResult, Python};
|
||||
use crate::{Bound, PyNativeType};
|
||||
use std::marker::PhantomData;
|
||||
use std::os::raw;
|
||||
use std::pin::Pin;
|
||||
|
@ -190,12 +192,10 @@ impl<'py, T: Element> FromPyObject<'py> for PyBuffer<T> {
|
|||
|
||||
impl<T: Element> PyBuffer<T> {
|
||||
/// Deprecated form of [`PyBuffer::get_bound`]
|
||||
#[cfg_attr(
|
||||
not(feature = "gil-refs"),
|
||||
deprecated(
|
||||
since = "0.21.0",
|
||||
note = "`PyBuffer::get` will be replaced by `PyBuffer::get_bound` in a future PyO3 version"
|
||||
)
|
||||
#[cfg(feature = "gil-refs")]
|
||||
#[deprecated(
|
||||
since = "0.21.0",
|
||||
note = "`PyBuffer::get` will be replaced by `PyBuffer::get_bound` in a future PyO3 version"
|
||||
)]
|
||||
pub fn get(obj: &PyAny) -> PyResult<PyBuffer<T>> {
|
||||
Self::get_bound(&obj.as_borrowed())
|
||||
|
|
Loading…
Reference in New Issue