@@ -3726,17 +3726,17 @@ def tearDown(self):
37263726 finally :
37273727 self .loop .close ()
37283728 asyncio .set_event_loop (None )
3729-
3729+
37303730 async def _test_coro (self ):
37313731 # Get the current task - this should not return None
37323732 current = asyncio .current_task ()
37333733 self .assertIsNotNone (current , "current_task() should not return None" )
37343734 return current
3735-
3735+
37363736
37373737 def current_task (self , eager = False ):
37383738 """Test that current_task() works correctly with _PyTask
3739-
3739+
37403740 This is a regression test for an issue where current_task() would return
37413741 None when called from within a _PyTask
37423742 The issue was caused by incomplete synchronization between the C and
@@ -3758,38 +3758,38 @@ def test_current_task(self):
37583758
37593759 def test_current_task_consistency_after_task_switch (self ):
37603760 """Test that current_task() remains consistent during task switching.
3761-
3761+
37623762 This tests the synchronization between C and Python implementations
37633763 when tasks are swapped in and out of execution.
37643764 """
37653765 results = []
3766-
3766+
37673767 async def task_a ():
37683768 results .append (('task_a_start' , asyncio .current_task ()))
37693769 await asyncio .sleep (0 ) # Yield control
37703770 results .append (('task_a_end' , asyncio .current_task ()))
37713771 return "A"
3772-
3772+
37733773 async def task_b ():
37743774 results .append (('task_b_start' , asyncio .current_task ()))
3775- await asyncio .sleep (0 ) # Yield control
3775+ await asyncio .sleep (0 ) # Yield control
37763776 results .append (('task_b_end' , asyncio .current_task ()))
37773777 return "B"
3778-
3778+
37793779 async def main ():
37803780 # Start both tasks concurrently
37813781 a = self .Task (task_a ())
37823782 b = self .Task (task_b ())
3783-
3783+
37843784 return await asyncio .gather (a , b )
3785-
3785+
37863786 result = self .loop .run_until_complete (main ())
37873787 self .assertEqual (result , ["A" , "B" ])
3788-
3788+
37893789 # Verify that current_task() was never None and was consistent
37903790 for label , current_task in results :
37913791 self .assertIsNotNone (current_task , f"current_task() was None at { label } " )
3792-
3792+
37933793 # Verify we got results from both tasks
37943794 task_a_results = [r for r in results if r [0 ].startswith ('task_a' )]
37953795 task_b_results = [r for r in results if r [0 ].startswith ('task_b' )]
0 commit comments