feature gate deprecated APIs for `PyEllipsis`, `PyNone` and `PyNotImplemented` (#4132)

This commit is contained in:
Icxolu 2024-04-27 17:34:13 +02:00 committed by GitHub
parent 059c8b3862
commit 6fb972b232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 18 deletions

View File

@ -12,12 +12,10 @@ pyobject_native_type_extract!(PyEllipsis);
impl PyEllipsis {
/// Returns the `Ellipsis` object.
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyEllipsis::get` will be replaced by `PyEllipsis::get_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyEllipsis::get` will be replaced by `PyEllipsis::get_bound` in a future PyO3 version"
)]
#[inline]
pub fn get(py: Python<'_>) -> &PyEllipsis {

View File

@ -14,12 +14,10 @@ pyobject_native_type_extract!(PyNone);
impl PyNone {
/// Returns the `None` object.
/// Deprecated form of [`PyNone::get_bound`]
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyNone::get` will be replaced by `PyNone::get_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyNone::get` will be replaced by `PyNone::get_bound` in a future PyO3 version"
)]
#[inline]
pub fn get(py: Python<'_>) -> &PyNone {

View File

@ -12,12 +12,10 @@ pyobject_native_type_extract!(PyNotImplemented);
impl PyNotImplemented {
/// Returns the `NotImplemented` object.
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyNotImplemented::get` will be replaced by `PyNotImplemented::get_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyNotImplemented::get` will be replaced by `PyNotImplemented::get_bound` in a future PyO3 version"
)]
#[inline]
pub fn get(py: Python<'_>) -> &PyNotImplemented {