Deprecate the `PySet::empty` gil-ref constructor (#4082)

* Deprecate the `PySet::empty` gil-ref constructor

* add newsfragment
This commit is contained in:
David Hewitt 2024-04-14 22:38:40 +01:00
parent 4f7c7065c2
commit bd15f92a56
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1 @@
Deprecate the `PySet::empty()` gil-ref constructor.

View File

@ -58,7 +58,14 @@ impl PySet {
} }
/// Deprecated form of [`PySet::empty_bound`]. /// 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) Self::empty_bound(py).map(Bound::into_gil_ref)
} }