feature gate deprecated APIs for `PySlice` (#4141)

This commit is contained in:
Alex Gaynor 2024-04-30 19:55:43 -04:00 committed by GitHub
parent 2f3a33fda1
commit 261d27d197
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 12 deletions

View File

@ -48,12 +48,10 @@ impl PySliceIndices {
impl PySlice {
/// Deprecated form of `PySlice::new_bound`.
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PySlice::new` will be replaced by `PySlice::new_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PySlice::new` will be replaced by `PySlice::new_bound` in a future PyO3 version"
)]
pub fn new(py: Python<'_>, start: isize, stop: isize, step: isize) -> &PySlice {
Self::new_bound(py, start, stop, step).into_gil_ref()
@ -73,12 +71,10 @@ impl PySlice {
}
/// Deprecated form of `PySlice::full_bound`.
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PySlice::full` will be replaced by `PySlice::full_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PySlice::full` will be replaced by `PySlice::full_bound` in a future PyO3 version"
)]
pub fn full(py: Python<'_>) -> &PySlice {
PySlice::full_bound(py).into_gil_ref()