@@ -12,7 +12,7 @@ use super::objfloat;
12
12
use super :: objmemory:: PyMemoryView ;
13
13
use super :: objstr:: { PyString , PyStringRef } ;
14
14
use super :: objtype:: { self , PyClassRef } ;
15
- use crate :: bytesinner :: PyBytesInner ;
15
+ use crate :: byteslike :: PyBytesLike ;
16
16
use crate :: format:: FormatSpec ;
17
17
use crate :: function:: { OptionalArg , PyFuncArgs } ;
18
18
use crate :: pyobject:: {
@@ -554,14 +554,14 @@ impl PyInt {
554
554
} ;
555
555
556
556
let x = match args. byteorder . as_str ( ) {
557
- "big" => match signed {
558
- true => BigInt :: from_signed_bytes_be ( & args . bytes . elements ) ,
559
- false => BigInt :: from_bytes_be ( Sign :: Plus , & args . bytes . elements ) ,
560
- } ,
561
- "little" => match signed {
562
- true => BigInt :: from_signed_bytes_le ( & args . bytes . elements ) ,
563
- false => BigInt :: from_bytes_le ( Sign :: Plus , & args . bytes . elements ) ,
564
- } ,
557
+ "big" => args . bytes . with_ref ( |bytes| match signed {
558
+ true => BigInt :: from_signed_bytes_be ( bytes) ,
559
+ false => BigInt :: from_bytes_be ( Sign :: Plus , bytes) ,
560
+ } ) ,
561
+ "little" => args . bytes . with_ref ( |bytes| match signed {
562
+ true => BigInt :: from_signed_bytes_le ( bytes) ,
563
+ false => BigInt :: from_bytes_le ( Sign :: Plus , bytes) ,
564
+ } ) ,
565
565
_ => {
566
566
return Err (
567
567
vm. new_value_error ( "byteorder must be either 'little' or 'big'" . to_owned ( ) )
@@ -714,7 +714,7 @@ impl IntOptions {
714
714
#[ derive( FromArgs ) ]
715
715
struct IntFromByteArgs {
716
716
#[ pyarg( positional_or_keyword) ]
717
- bytes : PyBytesInner ,
717
+ bytes : PyBytesLike ,
718
718
#[ pyarg( positional_or_keyword) ]
719
719
byteorder : PyStringRef ,
720
720
#[ pyarg( keyword_only, optional = true ) ]
0 commit comments