gh-140050: keep current task state in sync between python tasks and c tasks #140055
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
When updating the currently running task for a python impmlemented task (_PyTask), also inform the C bookkeping code in
_asyncioso that query functions such ascurrent_task()work correcty.This allows running Python-based tasks even if the
_asynciomodule is available._asynciomodule when setting the current task, via the_enter_task(),leave_taskand_swap_current_task()functions._asynciomodule as primary source of truth forcurrent_task()_asynciomodule when setting current event loop and when querying it.There are unit test cases,
test_asyncio.test_events.TestPyGetEventLoop.test_get_event_loop_new_processandtest_asyncio.test_futures2.PyFutureTeststhat started failing when this PR was partially implemented, because they use_PyTaskobjects. They previously just happened to work because the tasks thus created were not making use of thecurrent_task()api.