@@ -28,8 +28,8 @@ mod array {
2828 AsBuffer , AsMapping , Comparable , Constructor , IterNext , IterNextIterable , Iterable ,
2929 PyComparisonOp ,
3030 } ,
31- IdProtocol , PyComparisonValue , PyObjectRef , PyRef , PyResult , PyValue , TryFromObject ,
32- TypeProtocol , VirtualMachine ,
31+ IdProtocol , Py , PyComparisonValue , PyObj , PyObjectRef , PyRef , PyResult , PyValue ,
32+ TryFromObject , TypeProtocol , VirtualMachine ,
3333 } ;
3434 use crossbeam_utils:: atomic:: AtomicCell ;
3535 use itertools:: Itertools ;
@@ -1111,7 +1111,7 @@ mod array {
11111111 let iter = Iterator :: zip ( array_a. iter ( vm) , array_b. iter ( vm) ) ;
11121112
11131113 for ( a, b) in iter {
1114- if !vm. bool_eq ( & a?, & b?) ? {
1114+ if !vm. bool_eq ( & * a?, & * b?) ? {
11151115 return Ok ( false ) ;
11161116 }
11171117 }
@@ -1167,8 +1167,8 @@ mod array {
11671167
11681168 impl Comparable for PyArray {
11691169 fn cmp (
1170- zelf : & PyRef < Self > ,
1171- other : & PyObjectRef ,
1170+ zelf : & Py < Self > ,
1171+ other : & PyObj ,
11721172 op : PyComparisonOp ,
11731173 vm : & VirtualMachine ,
11741174 ) -> PyResult < PyComparisonValue > {
@@ -1195,8 +1195,12 @@ mod array {
11951195
11961196 for ( a, b) in iter {
11971197 let ret = match op {
1198- PyComparisonOp :: Lt | PyComparisonOp :: Le => vm. bool_seq_lt ( & a?, & b?) ?,
1199- PyComparisonOp :: Gt | PyComparisonOp :: Ge => vm. bool_seq_gt ( & a?, & b?) ?,
1198+ PyComparisonOp :: Lt | PyComparisonOp :: Le => {
1199+ vm. bool_seq_lt ( & * a?, & * b?) ?
1200+ }
1201+ PyComparisonOp :: Gt | PyComparisonOp :: Ge => {
1202+ vm. bool_seq_gt ( & * a?, & * b?) ?
1203+ }
12001204 _ => unreachable ! ( ) ,
12011205 } ;
12021206 if let Some ( v) = ret {
@@ -1214,11 +1218,11 @@ mod array {
12141218 }
12151219
12161220 impl AsBuffer for PyArray {
1217- fn as_buffer ( zelf : & PyRef < Self > , _vm : & VirtualMachine ) -> PyResult < PyBuffer > {
1221+ fn as_buffer ( zelf : & Py < Self > , _vm : & VirtualMachine ) -> PyResult < PyBuffer > {
12181222 let array = zelf. read ( ) ;
12191223 let buf = PyBuffer :: new (
1220- zelf. as_object ( ) . clone ( ) ,
1221- PyArrayBufferInternal ( zelf. clone ( ) ) ,
1224+ zelf. as_object ( ) . incref ( ) ,
1225+ PyArrayBufferInternal ( zelf. incref ( ) ) ,
12221226 BufferOptions {
12231227 readonly : false ,
12241228 len : array. len ( ) ,
@@ -1253,7 +1257,7 @@ mod array {
12531257 }
12541258
12551259 impl AsMapping for PyArray {
1256- fn as_mapping ( _zelf : & PyRef < Self > , _vm : & VirtualMachine ) -> PyMappingMethods {
1260+ fn as_mapping ( _zelf : & Py < Self > , _vm : & VirtualMachine ) -> PyMappingMethods {
12571261 PyMappingMethods {
12581262 length : Some ( Self :: length) ,
12591263 subscript : Some ( Self :: subscript) ,
@@ -1322,7 +1326,7 @@ mod array {
13221326
13231327 impl IterNextIterable for PyArrayIter { }
13241328 impl IterNext for PyArrayIter {
1325- fn next ( zelf : & PyRef < Self > , vm : & VirtualMachine ) -> PyResult < PyIterReturn > {
1329+ fn next ( zelf : & Py < Self > , vm : & VirtualMachine ) -> PyResult < PyIterReturn > {
13261330 let pos = zelf. position . fetch_add ( 1 ) ;
13271331 let r = if let Some ( item) = zelf. array . read ( ) . getitem_by_idx ( pos, vm) ? {
13281332 PyIterReturn :: Return ( item)
0 commit comments