Skip to content

Commit a5cf95d

Browse files
update to PyO3 0.9.0-alpha.1
1 parent 5cfe4f1 commit a5cf95d

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See Notices.txt for copyright information
33
[package]
44
name = "algebraics"
5-
version = "0.1.2"
5+
version = "0.1.3-alpha.1"
66
authors = ["Jacob Lifshay <[email protected]>"]
77
edition = "2018"
88
license = "LGPL-2.1-or-later"
@@ -31,6 +31,6 @@ rand_pcg = "0.1.1"
3131
lazy_static = "1.4"
3232

3333
[dependencies.pyo3]
34-
version = "0.8.2"
34+
version = "0.9.0-alpha.1"
3535
optional = true
3636
features = ["num-bigint"]

src/python.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@
33

44
#![cfg(feature = "python")]
55

6-
use crate::algebraic_numbers::RealAlgebraicNumber;
7-
use crate::traits::ExactDivAssign;
6+
use crate::{algebraic_numbers::RealAlgebraicNumber, traits::ExactDivAssign};
87
use num_bigint::BigInt;
9-
use num_traits::Signed;
10-
use num_traits::Zero;
11-
use pyo3::basic::CompareOp;
12-
use pyo3::exceptions::TypeError;
13-
use pyo3::exceptions::ValueError;
14-
use pyo3::exceptions::ZeroDivisionError;
15-
use pyo3::prelude::*;
16-
use pyo3::types::PyAny;
17-
use pyo3::PyNativeType;
18-
use pyo3::PyNumberProtocol;
19-
use pyo3::PyObjectProtocol;
8+
use num_traits::{Signed, Zero};
9+
use pyo3::{
10+
basic::CompareOp,
11+
exceptions::{TypeError, ValueError, ZeroDivisionError},
12+
prelude::*,
13+
types::PyAny,
14+
PyNativeType, PyNumberProtocol, PyObjectProtocol,
15+
};
2016
use std::sync::Arc;
2117

2218
impl FromPyObject<'_> for RealAlgebraicNumber {
@@ -81,10 +77,10 @@ impl FromPyObject<'_> for RealAlgebraicNumberPy {
8177
#[pymethods(PyObjectProtocol, PyNumberProtocol)]
8278
impl RealAlgebraicNumberPy {
8379
#[new]
84-
fn pynew(obj: &PyRawObject, value: Option<RealAlgebraicNumberPy>) {
85-
obj.init(value.unwrap_or_else(|| RealAlgebraicNumberPy {
80+
fn pynew(value: Option<RealAlgebraicNumberPy>) -> RealAlgebraicNumberPy {
81+
value.unwrap_or_else(|| RealAlgebraicNumberPy {
8682
value: RealAlgebraicNumber::zero().into(),
87-
}));
83+
})
8884
}
8985
fn __trunc__(&self) -> BigInt {
9086
let gil = Python::acquire_gil();

0 commit comments

Comments
 (0)