Skip to content

Commit 5534a7b

Browse files
authored
feature gate deprecated APIs for PyBuffer (#4144)
1 parent dc9a415 commit 5534a7b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/buffer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
// DEALINGS IN THE SOFTWARE.
1919

2020
//! `PyBuffer` implementation
21+
use crate::Bound;
22+
#[cfg(feature = "gil-refs")]
23+
use crate::PyNativeType;
2124
use crate::{err, exceptions::PyBufferError, ffi, FromPyObject, PyAny, PyResult, Python};
22-
use crate::{Bound, PyNativeType};
2325
use std::marker::PhantomData;
2426
use std::os::raw;
2527
use std::pin::Pin;
@@ -190,12 +192,10 @@ impl<'py, T: Element> FromPyObject<'py> for PyBuffer<T> {
190192

191193
impl<T: Element> PyBuffer<T> {
192194
/// Deprecated form of [`PyBuffer::get_bound`]
193-
#[cfg_attr(
194-
not(feature = "gil-refs"),
195-
deprecated(
196-
since = "0.21.0",
197-
note = "`PyBuffer::get` will be replaced by `PyBuffer::get_bound` in a future PyO3 version"
198-
)
195+
#[cfg(feature = "gil-refs")]
196+
#[deprecated(
197+
since = "0.21.0",
198+
note = "`PyBuffer::get` will be replaced by `PyBuffer::get_bound` in a future PyO3 version"
199199
)]
200200
pub fn get(obj: &PyAny) -> PyResult<PyBuffer<T>> {
201201
Self::get_bound(&obj.as_borrowed())

0 commit comments

Comments
 (0)