From a3f4335229003dd6ed2ae9c1d8c9887cf5453e8e Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Sun, 14 Apr 2024 21:44:16 +0100 Subject: [PATCH 1/2] Deprecate the `PySet::empty` gil-ref constructor --- src/types/set.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/types/set.rs b/src/types/set.rs index 4f1fcf8499f..f648bc2be1f 100644 --- a/src/types/set.rs +++ b/src/types/set.rs @@ -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) } From c07e98cdc2d2ee77ccba04876a91ebed1f1eb7dc Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Sun, 14 Apr 2024 21:48:00 +0100 Subject: [PATCH 2/2] add newsfragment --- newsfragments/4082.changed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/4082.changed.md diff --git a/newsfragments/4082.changed.md b/newsfragments/4082.changed.md new file mode 100644 index 00000000000..231ea0ae576 --- /dev/null +++ b/newsfragments/4082.changed.md @@ -0,0 +1 @@ +Deprecate the `PySet::empty()` gil-ref constructor.