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 committed by GitHub
parent 8ed5c17b93
commit a5201c04af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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`].
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)
}