@@ -8,7 +8,7 @@ use crate::{
88 function:: OptionalArg ,
99 protocol:: { PyIter , PyIterReturn } ,
1010 types:: { Constructor , IterNext , IterNextIterable } ,
11- AsObject , Context , Py , PyObjectRef , PyPayload , PyRef , PyResult , VirtualMachine ,
11+ AsObject , Context , Py , PyObjectRef , PyPayload , PyResult , VirtualMachine ,
1212} ;
1313use num_bigint:: BigInt ;
1414use num_traits:: Zero ;
@@ -51,17 +51,21 @@ impl Constructor for PyEnumerate {
5151 }
5252}
5353
54- #[ pyclass( with( IterNext , Constructor ) , flags( BASETYPE ) ) ]
54+ #[ pyclass( with( Py , IterNext , Constructor ) , flags( BASETYPE ) ) ]
5555impl PyEnumerate {
5656 #[ pyclassmethod( magic) ]
5757 fn class_getitem ( cls : PyTypeRef , args : PyObjectRef , vm : & VirtualMachine ) -> PyGenericAlias {
5858 PyGenericAlias :: new ( cls, args, vm)
5959 }
60+ }
61+
62+ #[ pyclass]
63+ impl Py < PyEnumerate > {
6064 #[ pymethod( magic) ]
61- fn reduce ( zelf : PyRef < Self > ) -> ( PyTypeRef , ( PyIter , BigInt ) ) {
65+ fn reduce ( & self ) -> ( PyTypeRef , ( PyIter , BigInt ) ) {
6266 (
63- zelf . class ( ) . to_owned ( ) ,
64- ( zelf . iterator . clone ( ) , zelf . counter . read ( ) . clone ( ) ) ,
67+ self . class ( ) . to_owned ( ) ,
68+ ( self . iterator . clone ( ) , self . counter . read ( ) . clone ( ) ) ,
6569 )
6670 }
6771}
0 commit comments