Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/conversions/num_complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ use std::os::raw::c_double;

impl PyComplex {
/// Deprecated form of [`PyComplex::from_complex_bound`]
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyComplex::from_complex` will be replaced by `PyComplex::from_complex_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyComplex::from_complex` will be replaced by `PyComplex::from_complex_bound` in a future PyO3 version"
)]
pub fn from_complex<F: Into<c_double>>(py: Python<'_>, complex: Complex<F>) -> &PyComplex {
Self::from_complex_bound(py, complex).into_gil_ref()
Expand Down
10 changes: 4 additions & 6 deletions src/types/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ pyobject_native_type!(

impl PyComplex {
/// Deprecated form of [`PyComplex::from_doubles_bound`]
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyComplex::from_doubles` will be replaced by `PyComplex::from_doubles_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyComplex::from_doubles` will be replaced by `PyComplex::from_doubles_bound` in a future PyO3 version"
)]
pub fn from_doubles(py: Python<'_>, real: c_double, imag: c_double) -> &PyComplex {
Self::from_doubles_bound(py, real, imag).into_gil_ref()
Expand Down
18 changes: 9 additions & 9 deletions src/types/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ pyobject_native_type!(
impl PyFloat {
/// Deprecated form of [`PyFloat::new_bound`].
#[inline]
#[cfg_attr(
not(feature = "gil-refs"),
deprecated(
since = "0.21.0",
note = "`PyFloat::new` will be replaced by `PyFloat::new_bound` in a future PyO3 version"
)
#[cfg(feature = "gil-refs")]
#[deprecated(
since = "0.21.0",
note = "`PyFloat::new` will be replaced by `PyFloat::new_bound` in a future PyO3 version"
)]
pub fn new(py: Python<'_>, val: f64) -> &'_ Self {
Self::new_bound(py, val).into_gil_ref()
Expand Down Expand Up @@ -154,9 +152,11 @@ impl<'py> FromPyObject<'py> for f32 {
}

#[cfg(test)]
#[cfg_attr(not(feature = "gil-refs"), allow(deprecated))]
mod tests {
use crate::{types::PyFloat, Python, ToPyObject};
use crate::{
types::{PyFloat, PyFloatMethods},
Python, ToPyObject,
};

macro_rules! num_to_py_object_and_back (
($func_name:ident, $t1:ty, $t2:ty) => (
Expand Down Expand Up @@ -184,7 +184,7 @@ mod tests {

Python::with_gil(|py| {
let v = 1.23f64;
let obj = PyFloat::new(py, 1.23);
let obj = PyFloat::new_bound(py, 1.23);
assert_approx_eq!(v, obj.value());
});
}
Expand Down