diff --git a/examples/scalar.py b/examples/scalar.py index 308ec86..ff24921 100644 --- a/examples/scalar.py +++ b/examples/scalar.py @@ -42,4 +42,10 @@ # Conversion to int assert int(Scalar(0)) == 0 -assert int(Scalar(12345)) == 12345 \ No newline at end of file +assert int(Scalar(12345)) == 12345 + +# The ability to inherit Scalar +class NewScalar(Scalar): + pass + +assert NewScalar(1) == Scalar(1) \ No newline at end of file diff --git a/src/wrapper.rs b/src/wrapper.rs index 1bb9ded..1da9c89 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -14,7 +14,7 @@ const G2_COMPRESSED_SIZE: usize = 96; const SCALAR_SIZE: usize = 32; #[derive(Copy, Clone)] -#[pyclass] +#[pyclass(subclass)] pub struct G1Point(G1Projective); #[pymethods] @@ -99,7 +99,7 @@ impl G1Point { } #[derive(Copy, Clone)] -#[pyclass] +#[pyclass(subclass)] pub struct G2Point(G2Projective); #[pymethods] @@ -184,7 +184,7 @@ impl G2Point { } #[derive(Copy, Clone)] -#[pyclass] +#[pyclass(subclass)] pub struct Scalar(ark_bls12_381::Fr); #[pymethods] @@ -264,7 +264,7 @@ impl Scalar { } #[derive(Copy, Clone)] -#[pyclass] +#[pyclass(subclass)] pub struct GT(ark_bls12_381::Fq12); #[pymethods]