Skip to content

Commit

Permalink
feature gate deprecated APIs for PyBuffer (PyO3#4144)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored May 1, 2024
1 parent dc9a415 commit 5534a7b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 5534a7b

Please sign in to comment.