File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1069,8 +1069,6 @@ def test_fetchmany(self):
10691069 res = self .cu .fetchmany (100 )
10701070 self .assertEqual (res , [])
10711071
1072- # TODO: RUSTPYTHON
1073- @unittest .expectedFailure
10741072 def test_fetchmany_kw_arg (self ):
10751073 """Checks if fetchmany works with keyword arguments"""
10761074 self .cu .execute ("select name from test" )
Original file line number Diff line number Diff line change @@ -1461,6 +1461,12 @@ mod _sqlite {
14611461 statement : Option < PyRef < Statement > > ,
14621462 }
14631463
1464+ #[ derive( FromArgs ) ]
1465+ struct FetchManyArgs {
1466+ #[ pyarg( any, name = "size" , optional) ]
1467+ size : Option < c_int > ,
1468+ }
1469+
14641470 #[ pyclass( with( Constructor , IterNext , Iterable ) , flags( BASETYPE ) ) ]
14651471 impl Cursor {
14661472 fn new (
@@ -1684,14 +1690,17 @@ mod _sqlite {
16841690 #[ pymethod]
16851691 fn fetchmany (
16861692 zelf : & Py < Self > ,
1687- max_rows : OptionalArg < c_int > ,
1693+ args : FetchManyArgs ,
16881694 vm : & VirtualMachine ,
16891695 ) -> PyResult < Vec < PyObjectRef > > {
1690- let max_rows = max_rows. unwrap_or_else ( || zelf. arraysize . load ( Ordering :: Relaxed ) ) ;
1696+ let max_rows = args
1697+ . size
1698+ . unwrap_or_else ( || zelf. arraysize . load ( Ordering :: Relaxed ) ) ;
1699+
16911700 let mut list = vec ! [ ] ;
1692- while let PyIterReturn :: Return ( row) = Self :: next ( zelf, vm) ? {
1701+ while let PyIterReturn :: Return ( row) = Cursor :: next ( zelf, vm) ? {
16931702 list. push ( row) ;
1694- if list. len ( ) as c_int >= max_rows {
1703+ if max_rows > 0 && list. len ( ) as c_int >= max_rows {
16951704 break ;
16961705 }
16971706 }
You can’t perform that action at this time.
0 commit comments