@@ -74,8 +74,8 @@ fn take_output_result_into_py(
7474 take_output_result : TakeOutputResult ,
7575) -> Bound < ' _ , PyAny > {
7676 match take_output_result {
77- TakeOutputResult :: Buffer ( b) => PyBytes :: new_bound ( py, & b) . into_any ( ) ,
78- TakeOutputResult :: EOF => PyNone :: get_bound ( py) . to_owned ( ) . into_any ( ) ,
77+ TakeOutputResult :: Buffer ( b) => PyBytes :: new ( py, & b) . into_any ( ) ,
78+ TakeOutputResult :: EOF => PyNone :: get ( py) . to_owned ( ) . into_any ( ) ,
7979 }
8080}
8181
@@ -319,7 +319,7 @@ impl PyVM {
319319 fn do_progress (
320320 mut self_ : PyRefMut < ' _ , Self > ,
321321 any_handle : Vec < PyNotificationHandle > ,
322- ) -> Result < Bound < ' _ , PyAny > , PyVMError > {
322+ ) -> PyResult < Bound < ' _ , PyAny > > {
323323 let res = self_. vm . do_progress (
324324 any_handle
325325 . into_iter ( )
@@ -330,30 +330,26 @@ impl PyVM {
330330 let py = self_. py ( ) ;
331331
332332 match res {
333- Err ( e) if e. is_suspended_error ( ) => {
334- Ok ( PySuspended . into_py ( py) . into_bound ( py) . into_any ( ) )
333+ Err ( e) if e. is_suspended_error ( ) => Ok ( Bound :: new ( py, PySuspended ) ?. into_any ( ) ) ,
334+ Err ( e) => Err ( PyVMError :: from ( e) ) ?,
335+ Ok ( DoProgressResponse :: AnyCompleted ) => {
336+ Ok ( Bound :: new ( py, PyDoProgressAnyCompleted ) ?. into_any ( ) )
335337 }
336- Err ( e) => Err ( e. into ( ) ) ,
337- Ok ( DoProgressResponse :: AnyCompleted ) => Ok ( PyDoProgressAnyCompleted
338- . into_py ( py)
339- . into_bound ( py)
340- . into_any ( ) ) ,
341- Ok ( DoProgressResponse :: ReadFromInput ) => Ok ( PyDoProgressReadFromInput
342- . into_py ( py)
343- . into_bound ( py)
344- . into_any ( ) ) ,
345- Ok ( DoProgressResponse :: ExecuteRun ( handle) ) => Ok ( PyDoProgressExecuteRun {
346- handle : handle. into ( ) ,
338+ Ok ( DoProgressResponse :: ReadFromInput ) => {
339+ Ok ( Bound :: new ( py, PyDoProgressReadFromInput ) ?. into_any ( ) )
347340 }
348- . into_py ( py)
349- . into_bound ( py)
341+ Ok ( DoProgressResponse :: ExecuteRun ( handle) ) => Ok ( Bound :: new (
342+ py,
343+ PyDoProgressExecuteRun {
344+ handle : handle. into ( ) ,
345+ } ,
346+ ) ?
350347 . into_any ( ) ) ,
351- Ok ( DoProgressResponse :: CancelSignalReceived ) => Ok ( PyDoProgressCancelSignalReceived
352- . into_py ( py)
353- . into_bound ( py)
354- . into_any ( ) ) ,
348+ Ok ( DoProgressResponse :: CancelSignalReceived ) => {
349+ Ok ( Bound :: new ( py, PyDoProgressCancelSignalReceived ) ?. into_any ( ) )
350+ }
355351 Ok ( DoProgressResponse :: WaitingPendingRun ) => {
356- Ok ( PyDoWaitForPendingRun . into_py ( py) . into_bound ( py ) . into_any ( ) )
352+ Ok ( Bound :: new ( py, PyDoWaitForPendingRun ) ? . into_any ( ) )
357353 }
358354 }
359355 }
@@ -370,27 +366,23 @@ impl PyVM {
370366 fn take_notification (
371367 mut self_ : PyRefMut < ' _ , Self > ,
372368 handle : PyNotificationHandle ,
373- ) -> Result < Bound < ' _ , PyAny > , PyVMError > {
369+ ) -> PyResult < Bound < ' _ , PyAny > > {
374370 let res = self_. vm . take_notification ( NotificationHandle :: from ( handle) ) ;
375371
376372 let py = self_. py ( ) ;
377373
378374 match res {
379- Err ( e) if e. is_suspended_error ( ) => {
380- Ok ( PySuspended . into_py ( py) . into_bound ( py) . into_any ( ) )
381- }
382- Err ( e) => Err ( e. into ( ) ) ,
383- Ok ( None ) => Ok ( PyNone :: get_bound ( py) . to_owned ( ) . into_any ( ) ) ,
384- Ok ( Some ( Value :: Void ) ) => Ok ( PyVoid . into_py ( py) . into_bound ( py) . into_any ( ) ) ,
385- Ok ( Some ( Value :: Success ( b) ) ) => Ok ( PyBytes :: new_bound ( py, & b) . into_any ( ) ) ,
386- Ok ( Some ( Value :: Failure ( f) ) ) => {
387- Ok ( PyFailure :: from ( f) . into_py ( py) . into_bound ( py) . into_any ( ) )
388- }
375+ Err ( e) if e. is_suspended_error ( ) => Ok ( Bound :: new ( py, PySuspended ) ?. into_any ( ) ) ,
376+ Err ( e) => Err ( PyVMError :: from ( e) ) ?,
377+ Ok ( None ) => Ok ( PyNone :: get ( py) . to_owned ( ) . into_any ( ) ) ,
378+ Ok ( Some ( Value :: Void ) ) => Ok ( Bound :: new ( py, PyVoid ) ?. into_any ( ) ) ,
379+ Ok ( Some ( Value :: Success ( b) ) ) => Ok ( PyBytes :: new ( py, & b) . into_any ( ) ) ,
380+ Ok ( Some ( Value :: Failure ( f) ) ) => Ok ( Bound :: new ( py, PyFailure :: from ( f) ) ?. into_any ( ) ) ,
389381 Ok ( Some ( Value :: StateKeys ( keys) ) ) => {
390- Ok ( PyStateKeys { keys } . into_py ( py ) . into_bound ( py ) . into_any ( ) )
382+ Ok ( Bound :: new ( py , PyStateKeys { keys } ) ? . into_any ( ) )
391383 }
392384 Ok ( Some ( Value :: InvocationId ( invocation_id) ) ) => {
393- Ok ( PyString :: new_bound ( py, & invocation_id) . into_any ( ) )
385+ Ok ( PyString :: new ( py, & invocation_id) . into_any ( ) )
394386 }
395387 }
396388 }
@@ -490,6 +482,7 @@ impl PyVM {
490482 }
491483
492484 #[ pyo3( signature = ( service, handler, buffer, key=None , delay=None , idempotency_key=None , headers=None ) ) ]
485+ #[ allow( clippy:: too_many_arguments) ]
493486 fn sys_send (
494487 mut self_ : PyRefMut < ' _ , Self > ,
495488 service : String ,
@@ -681,7 +674,6 @@ impl PyVM {
681674 self_
682675 . vm
683676 . sys_write_output ( NonEmptyValue :: Success ( buffer. as_bytes ( ) . to_vec ( ) . into ( ) ) )
684- . map ( Into :: into)
685677 . map_err ( Into :: into)
686678 }
687679
@@ -692,7 +684,6 @@ impl PyVM {
692684 self_
693685 . vm
694686 . sys_write_output ( NonEmptyValue :: Failure ( value. into ( ) ) )
695- . map ( Into :: into)
696687 . map_err ( Into :: into)
697688 }
698689
@@ -710,7 +701,7 @@ impl PyVM {
710701 }
711702
712703 fn sys_end ( mut self_ : PyRefMut < ' _ , Self > ) -> Result < ( ) , PyVMError > {
713- self_. vm . sys_end ( ) . map ( Into :: into ) . map_err ( Into :: into)
704+ self_. vm . sys_end ( ) . map_err ( Into :: into)
714705 }
715706}
716707
@@ -781,14 +772,14 @@ fn _internal(m: &Bound<'_, PyModule>) -> PyResult<()> {
781772 m. add_class :: < PyDoWaitForPendingRun > ( ) ?;
782773 m. add_class :: < PyCallHandle > ( ) ?;
783774
784- m. add ( "VMException" , m. py ( ) . get_type_bound :: < VMException > ( ) ) ?;
775+ m. add ( "VMException" , m. py ( ) . get_type :: < VMException > ( ) ) ?;
785776 m. add (
786777 "IdentityKeyException" ,
787- m. py ( ) . get_type_bound :: < IdentityKeyException > ( ) ,
778+ m. py ( ) . get_type :: < IdentityKeyException > ( ) ,
788779 ) ?;
789780 m. add (
790781 "IdentityVerificationException" ,
791- m. py ( ) . get_type_bound :: < IdentityVerificationException > ( ) ,
782+ m. py ( ) . get_type :: < IdentityVerificationException > ( ) ,
792783 ) ?;
793784 m. add ( "SDK_VERSION" , CURRENT_VERSION ) ?;
794785 m. add (
0 commit comments