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
8 changes: 4 additions & 4 deletions guide/src/class/numeric.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ impl Number {
self.0 as f64
}

fn __complex__<'py>(&self, py: Python<'py>) -> &'py PyComplex {
PyComplex::from_doubles(py, self.0 as f64, 0.0)
fn __complex__<'py>(&self, py: Python<'py>) -> Bound<'py, PyComplex> {
PyComplex::from_doubles_bound(py, self.0 as f64, 0.0)
}
}
```
Expand Down Expand Up @@ -321,8 +321,8 @@ impl Number {
self.0 as f64
}

fn __complex__<'py>(&self, py: Python<'py>) -> &'py PyComplex {
PyComplex::from_doubles(py, self.0 as f64, 0.0)
fn __complex__<'py>(&self, py: Python<'py>) -> Bound<'py, PyComplex> {
PyComplex::from_doubles_bound(py, self.0 as f64, 0.0)
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/conversions/num_complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
//! #
//! # module.add_function(wrap_pyfunction!(get_eigenvalues, module)?)?;
//! #
//! # let m11 = PyComplex::from_doubles(py, 0_f64, -1_f64);
//! # let m12 = PyComplex::from_doubles(py, 1_f64, 0_f64);
//! # let m21 = PyComplex::from_doubles(py, 2_f64, -1_f64);
//! # let m22 = PyComplex::from_doubles(py, -1_f64, 0_f64);
//! # let m11 = PyComplex::from_doubles_bound(py, 0_f64, -1_f64);
//! # let m12 = PyComplex::from_doubles_bound(py, 1_f64, 0_f64);
//! # let m21 = PyComplex::from_doubles_bound(py, 2_f64, -1_f64);
//! # let m22 = PyComplex::from_doubles_bound(py, -1_f64, 0_f64);
//! #
//! # let result = module
//! # .getattr("get_eigenvalues")?
Expand Down
14 changes: 10 additions & 4 deletions src/tests/hygiene/pymethods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ impl Dummy {
slf
}

fn __complex__<'py>(&self, py: crate::Python<'py>) -> &'py crate::types::PyComplex {
crate::types::PyComplex::from_doubles(py, 0.0, 0.0)
fn __complex__<'py>(
&self,
py: crate::Python<'py>,
) -> crate::Bound<'py, crate::types::PyComplex> {
crate::types::PyComplex::from_doubles_bound(py, 0.0, 0.0)
}

fn __int__(&self) -> u32 {
Expand Down Expand Up @@ -673,8 +676,11 @@ impl Dummy {
slf
}

fn __complex__<'py>(&self, py: crate::Python<'py>) -> &'py crate::types::PyComplex {
crate::types::PyComplex::from_doubles(py, 0.0, 0.0)
fn __complex__<'py>(
&self,
py: crate::Python<'py>,
) -> crate::Bound<'py, crate::types::PyComplex> {
crate::types::PyComplex::from_doubles_bound(py, 0.0, 0.0)
}

fn __int__(&self) -> u32 {
Expand Down
Loading