Skip to content

Commit

Permalink
feature gate deprecated APIs for PySlice (#4141)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Apr 30, 2024
1 parent 2f3a33f commit 261d27d
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/types/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 261d27d

Please sign in to comment.