Skip to content

Commit

Permalink
Deprecate the PySet::empty gil-ref constructor (#4082)
Browse files Browse the repository at this point in the history
* Deprecate the `PySet::empty` gil-ref constructor

* add newsfragment
  • Loading branch information
davidhewitt committed Apr 16, 2024
1 parent 4f7c706 commit bd15f92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions newsfragments/4082.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate the `PySet::empty()` gil-ref constructor.
9 changes: 8 additions & 1 deletion src/types/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ impl PySet {
}

/// Deprecated form of [`PySet::empty_bound`].
pub fn empty(py: Python<'_>) -> PyResult<&'_ PySet> {
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.2",
note = "`PySet::empty` will be replaced by `PySet::empty_bound` in a future PyO3 version"
)
)]
pub fn empty(py: Python<'_>) -> PyResult<&PySet> {
Self::empty_bound(py).map(Bound::into_gil_ref)
}

Expand Down

0 comments on commit bd15f92

Please sign in to comment.