feature gate deprecated APIs for `PyMemoryView` (#4152)

This commit is contained in:
Alex Gaynor 2024-05-03 12:02:19 -04:00 committed by GitHub
parent 7cbb85476c
commit 93cfb51ebb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 6 deletions

View File

@ -11,12 +11,10 @@ pyobject_native_type_core!(PyMemoryView, pyobject_native_static_type_object!(ffi
impl PyMemoryView {
/// Deprecated form of [`PyMemoryView::from_bound`]
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyMemoryView::from` will be replaced by `PyMemoryView::from_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyMemoryView::from` will be replaced by `PyMemoryView::from_bound` in a future PyO3 version"
)]
pub fn from(src: &PyAny) -> PyResult<&PyMemoryView> {
PyMemoryView::from_bound(&src.as_borrowed()).map(Bound::into_gil_ref)