@@ -883,7 +883,8 @@ mod _sqlite {
883883 unsafe { cursor. row_factory . swap ( zelf. row_factory . to_owned ( ) ) } ;
884884 cursor
885885 } else {
886- Cursor :: new ( zelf. clone ( ) , zelf. row_factory . to_owned ( ) , vm) . into_ref ( vm)
886+ let row_factory = zelf. row_factory . to_owned ( ) ;
887+ Cursor :: new ( zelf, row_factory, vm) . into_ref ( vm)
887888 } ;
888889 Ok ( cursor)
889890 }
@@ -952,7 +953,8 @@ mod _sqlite {
952953 parameters : OptionalArg < PyObjectRef > ,
953954 vm : & VirtualMachine ,
954955 ) -> PyResult < PyRef < Cursor > > {
955- let cursor = Cursor :: new ( zelf. clone ( ) , zelf. row_factory . to_owned ( ) , vm) . into_ref ( vm) ;
956+ let row_factory = zelf. row_factory . to_owned ( ) ;
957+ let cursor = Cursor :: new ( zelf, row_factory, vm) . into_ref ( vm) ;
956958 Cursor :: execute ( cursor, sql, parameters, vm)
957959 }
958960
@@ -963,7 +965,8 @@ mod _sqlite {
963965 seq_of_params : ArgIterable ,
964966 vm : & VirtualMachine ,
965967 ) -> PyResult < PyRef < Cursor > > {
966- let cursor = Cursor :: new ( zelf. clone ( ) , zelf. row_factory . to_owned ( ) , vm) . into_ref ( vm) ;
968+ let row_factory = zelf. row_factory . to_owned ( ) ;
969+ let cursor = Cursor :: new ( zelf, row_factory, vm) . into_ref ( vm) ;
967970 Cursor :: executemany ( cursor, sql, seq_of_params, vm)
968971 }
969972
@@ -973,15 +976,12 @@ mod _sqlite {
973976 script : PyStrRef ,
974977 vm : & VirtualMachine ,
975978 ) -> PyResult < PyRef < Cursor > > {
976- Cursor :: executescript (
977- Cursor :: new ( zelf. clone ( ) , zelf. row_factory . to_owned ( ) , vm) . into_ref ( vm) ,
978- script,
979- vm,
980- )
979+ let row_factory = zelf. row_factory . to_owned ( ) ;
980+ Cursor :: executescript ( Cursor :: new ( zelf, row_factory, vm) . into_ref ( vm) , script, vm)
981981 }
982982
983983 #[ pymethod]
984- fn backup ( zelf : PyRef < Self > , args : BackupArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
984+ fn backup ( zelf : & Py < Self > , args : BackupArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
985985 let BackupArgs {
986986 target,
987987 pages,
@@ -1550,22 +1550,22 @@ mod _sqlite {
15501550 }
15511551
15521552 #[ pymethod]
1553- fn fetchone ( zelf : PyRef < Self > , vm : & VirtualMachine ) -> PyResult {
1554- Self :: next ( & zelf, vm) . map ( |x| match x {
1553+ fn fetchone ( zelf : & Py < Self > , vm : & VirtualMachine ) -> PyResult {
1554+ Self :: next ( zelf, vm) . map ( |x| match x {
15551555 PyIterReturn :: Return ( row) => row,
15561556 PyIterReturn :: StopIteration ( _) => vm. ctx . none ( ) ,
15571557 } )
15581558 }
15591559
15601560 #[ pymethod]
15611561 fn fetchmany (
1562- zelf : PyRef < Self > ,
1562+ zelf : & Py < Self > ,
15631563 max_rows : OptionalArg < c_int > ,
15641564 vm : & VirtualMachine ,
15651565 ) -> PyResult < Vec < PyObjectRef > > {
15661566 let max_rows = max_rows. unwrap_or_else ( || zelf. arraysize . load ( Ordering :: Relaxed ) ) ;
15671567 let mut list = vec ! [ ] ;
1568- while let PyIterReturn :: Return ( row) = Self :: next ( & zelf, vm) ? {
1568+ while let PyIterReturn :: Return ( row) = Self :: next ( zelf, vm) ? {
15691569 list. push ( row) ;
15701570 if list. len ( ) as c_int >= max_rows {
15711571 break ;
@@ -1575,9 +1575,9 @@ mod _sqlite {
15751575 }
15761576
15771577 #[ pymethod]
1578- fn fetchall ( zelf : PyRef < Self > , vm : & VirtualMachine ) -> PyResult < Vec < PyObjectRef > > {
1578+ fn fetchall ( zelf : & Py < Self > , vm : & VirtualMachine ) -> PyResult < Vec < PyObjectRef > > {
15791579 let mut list = vec ! [ ] ;
1580- while let PyIterReturn :: Return ( row) = Self :: next ( & zelf, vm) ? {
1580+ while let PyIterReturn :: Return ( row) = Self :: next ( zelf, vm) ? {
15811581 list. push ( row) ;
15821582 }
15831583 Ok ( list)
0 commit comments