feature gate deprecated APIs for `PyCapsule` (#4112)

This commit is contained in:
Icxolu 2024-04-24 19:34:19 +02:00 committed by GitHub
parent 013a4476ea
commit c951bf86de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 13 deletions

View File

@ -47,12 +47,10 @@ pyobject_native_type_core!(PyCapsule, pyobject_native_static_type_object!(ffi::P
impl PyCapsule {
/// Deprecated form of [`PyCapsule::new_bound`].
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyCapsule::new` will be replaced by `PyCapsule::new_bound` in a future PyO3 version"
)
)]
pub fn new<T: 'static + Send + AssertNotZeroSized>(
py: Python<'_>,
@ -102,12 +100,10 @@ impl PyCapsule {
}
/// Deprecated form of [`PyCapsule::new_bound_with_destructor`].
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyCapsule::new_with_destructor` will be replaced by `PyCapsule::new_bound_with_destructor` in a future PyO3 version"
)
)]
pub fn new_with_destructor<
T: 'static + Send + AssertNotZeroSized,
@ -441,7 +437,6 @@ fn name_ptr_ignore_error(slf: &Bound<'_, PyCapsule>) -> *const c_char {
}
#[cfg(test)]
#[cfg_attr(not(feature = "gil-refs"), allow(deprecated))]
mod tests {
use libc::c_void;