File tree Expand file tree Collapse file tree 3 files changed +4
-21
lines changed
Expand file tree Collapse file tree 3 files changed +4
-21
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,6 @@ def test_long_a(self):
381381 self .assertRaises (ValueError , int , '-012395' , 0 )
382382
383383
384- @unittest .expectedFailure # TODO: RUSTPYTHON
385384 def test_conversion (self ):
386385
387386 class JustLong :
Original file line number Diff line number Diff line change @@ -21,14 +21,6 @@ pub struct PyComplex {
2121 value : Complex64 ,
2222}
2323
24- impl < ' a > BorrowValue < ' a > for PyComplex {
25- type Borrowed = & ' a Complex64 ;
26-
27- fn borrow_value ( & ' a self ) -> Self :: Borrowed {
28- & self . value
29- }
30- }
31-
3224impl PyValue for PyComplex {
3325 fn class ( vm : & VirtualMachine ) -> & PyTypeRef {
3426 & vm. ctx . types . complex_type
@@ -53,13 +45,13 @@ pub fn init(context: &PyContext) {
5345
5446fn try_complex ( obj : & PyObjectRef , vm : & VirtualMachine ) -> PyResult < Option < Complex64 > > {
5547 if let Some ( complex) = obj. payload_if_exact :: < PyComplex > ( vm) {
56- return Ok ( Some ( complex. borrow_value ( ) . clone ( ) ) ) ;
48+ return Ok ( Some ( complex. value ) ) ;
5749 }
5850 if let Some ( method) = vm. get_method ( obj. clone ( ) , "__complex__" ) {
5951 let result = vm. invoke ( & method?, ( ) ) ?;
6052 // TODO: returning strict subclasses of complex in __complex__ is deprecated
6153 return match result. payload :: < PyComplex > ( ) {
62- Some ( complex_obj) => Ok ( Some ( complex_obj. borrow_value ( ) . clone ( ) ) ) ,
54+ Some ( complex_obj) => Ok ( Some ( complex_obj. value ) ) ,
6355 None => Err ( vm. new_type_error ( format ! (
6456 "__complex__ returned non-complex (type '{}')" ,
6557 result. class( ) . name
Original file line number Diff line number Diff line change @@ -26,14 +26,6 @@ pub struct PyFloat {
2626 value : f64 ,
2727}
2828
29- impl < ' a > BorrowValue < ' a > for PyFloat {
30- type Borrowed = & ' a f64 ;
31-
32- fn borrow_value ( & ' a self ) -> Self :: Borrowed {
33- & self . value
34- }
35- }
36-
3729impl PyFloat {
3830 pub fn to_f64 ( self ) -> f64 {
3931 self . value
@@ -65,13 +57,13 @@ impl From<f64> for PyFloat {
6557
6658pub ( crate ) fn try_float ( obj : & PyObjectRef , vm : & VirtualMachine ) -> PyResult < Option < f64 > > {
6759 if let Some ( float) = obj. payload_if_exact :: < PyFloat > ( vm) {
68- return Ok ( Some ( float. borrow_value ( ) . clone ( ) ) ) ;
60+ return Ok ( Some ( float. value ) ) ;
6961 }
7062 if let Some ( method) = vm. get_method ( obj. clone ( ) , "__float__" ) {
7163 let result = vm. invoke ( & method?, ( ) ) ?;
7264 // TODO: returning strict subclasses of float in __float__ is deprecated
7365 return match result. payload :: < PyFloat > ( ) {
74- Some ( float_obj) => Ok ( Some ( float_obj. borrow_value ( ) . clone ( ) ) ) ,
66+ Some ( float_obj) => Ok ( Some ( float_obj. value ) ) ,
7567 None => Err ( vm. new_type_error ( format ! (
7668 "__float__ returned non-float (type '{}')" ,
7769 result. class( ) . name
You can’t perform that action at this time.
0 commit comments