@@ -10,8 +10,8 @@ use super::objtype::PyClassRef;
1010use crate :: format:: FormatSpec ;
1111use crate :: function:: { OptionalArg , OptionalOption } ;
1212use crate :: pyobject:: {
13- IntoPyObject , IntoPyResult , PyArithmaticValue :: * , PyClassImpl , PyComparisonValue , PyContext ,
14- PyObjectRef , PyRef , PyResult , PyValue , TryFromObject , TypeProtocol ,
13+ BorrowValue , IntoPyObject , IntoPyResult , PyArithmaticValue :: * , PyClassImpl , PyComparisonValue ,
14+ PyContext , PyObjectRef , PyRef , PyResult , PyValue , TryFromObject , TypeProtocol ,
1515} ;
1616use crate :: vm:: VirtualMachine ;
1717use rustpython_common:: { float_ops, hash} ;
@@ -56,7 +56,7 @@ pub fn try_float(obj: &PyObjectRef, vm: &VirtualMachine) -> PyResult<Option<f64>
5656 let v = if let Some ( float) = obj. payload_if_subclass :: < PyFloat > ( vm) {
5757 Some ( float. value )
5858 } else if let Some ( int) = obj. payload_if_subclass :: < PyInt > ( vm) {
59- Some ( objint:: try_float ( int. as_bigint ( ) , vm) ?)
59+ Some ( objint:: try_float ( int. borrow_value ( ) , vm) ?)
6060 } else {
6161 None
6262 } ;
@@ -179,7 +179,7 @@ impl PyFloat {
179179 if let Some ( other) = other. payload_if_subclass :: < PyFloat > ( vm) {
180180 Implemented ( float_op ( self . value , other. value ) )
181181 } else if let Some ( other) = other. payload_if_subclass :: < PyInt > ( vm) {
182- Implemented ( int_op ( self . value , other. as_bigint ( ) ) )
182+ Implemented ( int_op ( self . value , other. borrow_value ( ) ) )
183183 } else {
184184 NotImplemented
185185 }
@@ -399,7 +399,7 @@ impl PyFloat {
399399 fn round ( & self , ndigits : OptionalOption < PyIntRef > , vm : & VirtualMachine ) -> PyResult {
400400 let ndigits = ndigits. flatten ( ) ;
401401 if let Some ( ndigits) = ndigits {
402- let ndigits = ndigits. as_bigint ( ) ;
402+ let ndigits = ndigits. borrow_value ( ) ;
403403 if ndigits. is_zero ( ) {
404404 let fract = self . value . fract ( ) ;
405405 let value = if ( fract. abs ( ) - 0.5 ) . abs ( ) < std:: f64:: EPSILON {
@@ -523,7 +523,7 @@ fn to_float(vm: &VirtualMachine, obj: &PyObjectRef) -> PyResult<f64> {
523523 let value = if let Some ( float) = obj. payload_if_subclass :: < PyFloat > ( vm) {
524524 float. value
525525 } else if let Some ( int) = obj. payload_if_subclass :: < PyInt > ( vm) {
526- objint:: try_float ( int. as_bigint ( ) , vm) ?
526+ objint:: try_float ( int. borrow_value ( ) , vm) ?
527527 } else if let Some ( s) = obj. payload_if_subclass :: < PyString > ( vm) {
528528 float_ops:: parse_str ( s. as_str ( ) . trim ( ) ) . ok_or_else ( || {
529529 vm. new_value_error ( format ! ( "could not convert string to float: '{}'" , s) )
0 commit comments