@@ -62,8 +62,8 @@ pub(crate) mod _asyncio {
6262
6363 #[ derive( FromArgs ) ]
6464 struct AddDoneCallbackArgs {
65- #[ pyarg( positional, name = "fn" ) ]
66- func : PyObjectRef ,
65+ #[ pyarg( positional) ]
66+ r#fn : PyObjectRef ,
6767 #[ pyarg( named, optional) ]
6868 context : Option < PyObjectRef > ,
6969 }
@@ -76,8 +76,8 @@ pub(crate) mod _asyncio {
7676
7777 #[ derive( FromArgs ) ]
7878 struct LoopArg {
79- #[ pyarg( any, name = "loop" , optional) ]
80- loop_ : Option < PyObjectRef > ,
79+ #[ pyarg( any, optional) ]
80+ r#loop : Option < PyObjectRef > ,
8181 }
8282
8383 #[ derive( FromArgs ) ]
@@ -146,15 +146,15 @@ pub(crate) mod _asyncio {
146146
147147 #[ derive( FromArgs ) ]
148148 struct FutureInitArgs {
149- #[ pyarg( named, name = "loop" , optional) ]
150- loop_ : Option < PyObjectRef > ,
149+ #[ pyarg( named, optional) ]
150+ r#loop : Option < PyObjectRef > ,
151151 }
152152
153153 impl Initializer for PyFuture {
154154 type Args = FutureInitArgs ;
155155
156156 fn init ( zelf : & Py < Self > , args : Self :: Args , vm : & VirtualMachine ) -> PyResult < ( ) > {
157- Self :: py_init ( zelf, args. loop_ , vm)
157+ Self :: py_init ( zelf, args. r#loop , vm)
158158 }
159159 }
160160
@@ -369,16 +369,16 @@ pub(crate) mod _asyncio {
369369 } ;
370370
371371 if self . fut_state . load ( ) != FutureState :: Pending {
372- self . call_soon_with_context ( owner, args. func , Some ( ctx) , vm) ?;
372+ self . call_soon_with_context ( owner, args. r#fn , Some ( ctx) , vm) ?;
373373 } else {
374374 let callbacks = self . fut_callbacks . read ( ) . clone ( ) ;
375375 // Once a list exists, append to it even if callback0 was removed.
376376 // Refilling callback0 would move the new callback ahead of the list.
377377 if callbacks. is_none ( ) && self . fut_callback0 . read ( ) . is_none ( ) {
378- * self . fut_callback0 . write ( ) = Some ( args. func ) ;
378+ * self . fut_callback0 . write ( ) = Some ( args. r#fn ) ;
379379 * self . fut_context0 . write ( ) = Some ( ctx) ;
380380 } else {
381- let tuple = vm. ctx . new_tuple ( vec ! [ args. func , ctx] ) ;
381+ let tuple = vm. ctx . new_tuple ( vec ! [ args. r#fn , ctx] ) ;
382382 if let Some ( callbacks) = callbacks {
383383 callbacks
384384 . downcast_ref :: < PyList > ( )
@@ -397,7 +397,7 @@ pub(crate) mod _asyncio {
397397 #[ pymethod]
398398 fn remove_done_callback (
399399 zelf : & Py < Self > ,
400- RemoveDoneCallbackArgs { func } : RemoveDoneCallbackArgs ,
400+ RemoveDoneCallbackArgs { r#fn : func } : RemoveDoneCallbackArgs ,
401401 vm : & VirtualMachine ,
402402 ) -> PyResult < isize > {
403403 zelf. remove_done_callback_impl ( & func, vm)
@@ -1175,8 +1175,8 @@ pub(crate) mod _asyncio {
11751175 struct TaskInitArgs {
11761176 #[ pyarg( any) ]
11771177 coro : PyObjectRef ,
1178- #[ pyarg( named, name = "loop" , optional) ]
1179- loop_ : Option < PyObjectRef > ,
1178+ #[ pyarg( named, optional) ]
1179+ r#loop : Option < PyObjectRef > ,
11801180 #[ pyarg( named, optional) ]
11811181 name : Option < PyObjectRef > ,
11821182 #[ pyarg( named, optional) ]
@@ -1235,7 +1235,7 @@ pub(crate) mod _asyncio {
12351235 }
12361236
12371237 // Get the event loop
1238- let loop_obj = match args. loop_ {
1238+ let loop_obj = match args. r#loop {
12391239 Some ( l) => l,
12401240 None => get_running_loop ( vm)
12411241 . map_err ( |_| vm. new_runtime_error ( "no current event loop" ) ) ?,
@@ -1419,7 +1419,7 @@ pub(crate) mod _asyncio {
14191419 #[ pymethod]
14201420 fn remove_done_callback (
14211421 zelf : & Py < Self > ,
1422- RemoveDoneCallbackArgs { func } : RemoveDoneCallbackArgs ,
1422+ RemoveDoneCallbackArgs { r#fn : func } : RemoveDoneCallbackArgs ,
14231423 vm : & VirtualMachine ,
14241424 ) -> PyResult < isize > {
14251425 zelf. base . remove_done_callback_impl ( & func, vm)
@@ -1900,7 +1900,7 @@ pub(crate) mod _asyncio {
19001900 // Swap current task - save previous task
19011901 let prev_task = _swap_current_task (
19021902 LoopTaskArgs {
1903- loop_ : loop_obj. clone ( ) ,
1903+ r#loop : loop_obj. clone ( ) ,
19041904 task : task_obj. clone ( ) ,
19051905 } ,
19061906 vm,
@@ -1929,7 +1929,7 @@ pub(crate) mod _asyncio {
19291929 . store ( false , Ordering :: Relaxed ) ;
19301930 let _ = _swap_current_task (
19311931 LoopTaskArgs {
1932- loop_ : loop_obj,
1932+ r#loop : loop_obj,
19331933 task : prev_task,
19341934 } ,
19351935 vm,
@@ -1961,7 +1961,7 @@ pub(crate) mod _asyncio {
19611961 None => {
19621962 let _ = _swap_current_task (
19631963 LoopTaskArgs {
1964- loop_ : loop_obj,
1964+ r#loop : loop_obj,
19651965 task : prev_task,
19661966 } ,
19671967 vm,
@@ -1974,7 +1974,7 @@ pub(crate) mod _asyncio {
19741974 // Restore previous task
19751975 let _ = _swap_current_task (
19761976 LoopTaskArgs {
1977- loop_ : loop_obj,
1977+ r#loop : loop_obj,
19781978 task : prev_task,
19791979 } ,
19801980 vm,
@@ -2043,7 +2043,7 @@ pub(crate) mod _asyncio {
20432043 // Enter task - register as current task
20442044 _enter_task (
20452045 LoopTaskArgs {
2046- loop_ : loop_obj. clone ( ) ,
2046+ r#loop : loop_obj. clone ( ) ,
20472047 task : task. to_owned ( ) ,
20482048 } ,
20492049 vm,
@@ -2088,7 +2088,7 @@ pub(crate) mod _asyncio {
20882088 // Leave task - unregister as current task (must happen even on error)
20892089 let _ = _leave_task (
20902090 LoopTaskArgs {
2091- loop_ : loop_obj,
2091+ r#loop : loop_obj,
20922092 task : task. to_owned ( ) ,
20932093 } ,
20942094 vm,
@@ -2464,13 +2464,13 @@ pub(crate) mod _asyncio {
24642464
24652465 #[ derive( FromArgs ) ]
24662466 struct SetRunningLoopArgs {
2467- #[ pyarg( positional, name = "loop" ) ]
2468- loop_ : Option < PyObjectRef > ,
2467+ #[ pyarg( positional) ]
2468+ r#loop : Option < PyObjectRef > ,
24692469 }
24702470
24712471 #[ pyfunction]
24722472 fn _set_running_loop ( args : SetRunningLoopArgs , vm : & VirtualMachine ) {
2473- * vm. asyncio_running_loop . borrow_mut ( ) = args. loop_ ;
2473+ * vm. asyncio_running_loop . borrow_mut ( ) = args. r#loop ;
24742474 }
24752475
24762476 #[ pyfunction]
@@ -2500,7 +2500,7 @@ pub(crate) mod _asyncio {
25002500
25012501 #[ pyfunction]
25022502 fn current_task ( args : LoopArg , vm : & VirtualMachine ) -> PyResult {
2503- let loop_obj = match args. loop_ {
2503+ let loop_obj = match args. r#loop {
25042504 Some ( l) if !vm. is_none ( & l) => l,
25052505 _ => {
25062506 // When loop is None or not provided, use the running loop
@@ -2543,7 +2543,7 @@ pub(crate) mod _asyncio {
25432543
25442544 #[ pyfunction]
25452545 fn all_tasks ( args : LoopArg , vm : & VirtualMachine ) -> PyResult {
2546- let loop_obj = match args. loop_ {
2546+ let loop_obj = match args. r#loop {
25472547 Some ( l) if !vm. is_none ( & l) => l,
25482548 _ => get_running_loop ( vm) ?,
25492549 } ;
@@ -2584,8 +2584,8 @@ pub(crate) mod _asyncio {
25842584
25852585 #[ derive( FromArgs ) ]
25862586 struct RemoveDoneCallbackArgs {
2587- #[ pyarg( positional, name = "fn" ) ]
2588- func : PyObjectRef ,
2587+ #[ pyarg( positional) ]
2588+ r#fn : PyObjectRef ,
25892589 }
25902590
25912591 #[ derive( FromArgs ) ]
@@ -2596,8 +2596,8 @@ pub(crate) mod _asyncio {
25962596
25972597 #[ derive( FromArgs ) ]
25982598 struct LoopTaskArgs {
2599- #[ pyarg( any, name = "loop" ) ]
2600- loop_ : PyObjectRef ,
2599+ #[ pyarg( any) ]
2600+ r#loop : PyObjectRef ,
26012601 #[ pyarg( any) ]
26022602 task : PyObjectRef ,
26032603 }
@@ -2634,7 +2634,10 @@ pub(crate) mod _asyncio {
26342634
26352635 #[ pyfunction]
26362636 fn _enter_task (
2637- LoopTaskArgs { loop_, task } : LoopTaskArgs ,
2637+ LoopTaskArgs {
2638+ r#loop : loop_,
2639+ task,
2640+ } : LoopTaskArgs ,
26382641 vm : & VirtualMachine ,
26392642 ) -> PyResult < ( ) > {
26402643 // Per-thread check, matching CPython's ts->asyncio_running_task
@@ -2662,7 +2665,10 @@ pub(crate) mod _asyncio {
26622665
26632666 #[ pyfunction]
26642667 fn _leave_task (
2665- LoopTaskArgs { loop_, task } : LoopTaskArgs ,
2668+ LoopTaskArgs {
2669+ r#loop : loop_,
2670+ task,
2671+ } : LoopTaskArgs ,
26662672 vm : & VirtualMachine ,
26672673 ) -> PyResult < ( ) > {
26682674 // Per-thread check, matching CPython's ts->asyncio_running_task
@@ -2690,7 +2696,10 @@ pub(crate) mod _asyncio {
26902696
26912697 #[ pyfunction]
26922698 fn _swap_current_task (
2693- LoopTaskArgs { loop_, task } : LoopTaskArgs ,
2699+ LoopTaskArgs {
2700+ r#loop : loop_,
2701+ task,
2702+ } : LoopTaskArgs ,
26942703 vm : & VirtualMachine ,
26952704 ) -> PyObjectRef {
26962705 // Per-thread swap, matching CPython's swap_current_task
0 commit comments