Skip to content

Replaced get_event_loop() with get_running_loop()#12425

Draft
agronholm wants to merge 3 commits intoaio-libs:masterfrom
agronholm:replace-get-event-loop
Draft

Replaced get_event_loop() with get_running_loop()#12425
agronholm wants to merge 3 commits intoaio-libs:masterfrom
agronholm:replace-get-event-loop

Conversation

@agronholm
Copy link
Copy Markdown
Contributor

@agronholm agronholm commented Apr 27, 2026

What do these changes do?

This is a search & replace operation that changes all uses of the get_event_loop() function to get_running_loop().

Are there changes in behavior for the user?

No

Is it a substantial burden for the maintainers to support this?

Nope

Related issue number

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder
    • name it <issue_or_pr_num>.<type>.rst (e.g. 588.bugfix.rst)

    • if you don't have an issue number, change it to the pull request
      number after creating the PR

      • .bugfix: A bug fix for something the maintainers deemed an
        improper undesired behavior that got corrected to match
        pre-agreed expectations.
      • .feature: A new behavior, public APIs. That sort of stuff.
      • .deprecation: A declaration of future API removals and breaking
        changes in behavior.
      • .breaking: When something public is removed in a breaking way.
        Could be deprecated in an earlier release.
      • .doc: Notable updates to the documentation structure or build
        process.
      • .packaging: Notes for downstreams about unobvious side effects
        and tooling. Changes in the test invocation considerations and
        runtime assumptions.
      • .contrib: Stuff that affects the contributor experience. e.g.
        Running tests, building the docs, setting up the development
        environment.
      • .misc: Changes that are hard to assign to any of the above
        categories.
    • Make sure to use full sentences with correct case and punctuation,
      for example:

      Fixed issue with non-ascii contents in doctest text files
      -- by :user:`contributor-gh-handle`.

      Use the past tense or the present tense a non-imperative mood,
      referring to what's changed compared to the last released version
      of this project.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label Apr 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
4436 4 4432 109
View the top 2 failed test(s) by shortest run time
tests.test_connector::test_del_with_closed_loop[pyloop]
Stack Traces | 0.06s run time
conn_closing_result = <_UnixSelectorEventLoop running=False closed=False debug=False>
should_close = True, kwargs = {}, @py_assert0 = None, @py_assert2 = None

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mcreate_mocked_conn#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        conn_closing_result: asyncio.AbstractEventLoop | #x1B[94mNone#x1B[39;49;00m = #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        should_close: #x1B[96mbool#x1B[39;49;00m = #x1B[94mTrue#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        **kwargs: #x1B[96mobject#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
    ) -> mock.Mock:#x1B[90m#x1B[39;49;00m
        #x1B[94massert#x1B[39;49;00m #x1B[33m"#x1B[39;49;00m#x1B[33mloop#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m #x1B[95mnot#x1B[39;49;00m #x1B[95min#x1B[39;49;00m kwargs#x1B[90m#x1B[39;49;00m
        #x1B[94mtry#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
>           loop = asyncio.get_running_loop()#x1B[90m#x1B[39;49;00m
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE           RuntimeError: no running event loop#x1B[0m

conn_closing_result = <_UnixSelectorEventLoop running=False closed=False debug=False>
kwargs     = {}
should_close = True

#x1B[1m#x1B[31mtests/test_connector.py#x1B[0m:127: RuntimeError

#x1B[33mDuring handling of the above exception, another exception occurred:#x1B[0m

loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
key = ConnectionKey(host='localhost', port=80, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=None)

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.mark.skipif(#x1B[90m#x1B[39;49;00m
        sys.implementation.name != #x1B[33m"#x1B[39;49;00m#x1B[33mcpython#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, reason=#x1B[33m"#x1B[39;49;00m#x1B[33mCPython GC is required for the test#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
    )#x1B[90m#x1B[39;49;00m
    #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_del_with_closed_loop#x1B[39;49;00m(  #x1B[90m# type: ignore[misc]#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        loop: asyncio.AbstractEventLoop, key: ConnectionKey#x1B[90m#x1B[39;49;00m
    ) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
        #x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mmake_conn#x1B[39;49;00m() -> aiohttp.BaseConnector:#x1B[90m#x1B[39;49;00m
            #x1B[94mreturn#x1B[39;49;00m aiohttp.BaseConnector()#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        conn = loop.run_until_complete(make_conn())#x1B[90m#x1B[39;49;00m
>       transp = create_mocked_conn(loop)#x1B[90m#x1B[39;49;00m
                 ^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m

conn       = <aiohttp.connector.BaseConnector object at 0x537d736a010>
key        = ConnectionKey(host='localhost', port=80, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=None)
loop       = <_UnixSelectorEventLoop running=False closed=False debug=False>
make_conn  = <function test_del_with_closed_loop.<locals>.make_conn at 0x537d7d648c0>

#x1B[1m#x1B[31mtests/test_connector.py#x1B[0m:264: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

conn_closing_result = <_UnixSelectorEventLoop running=False closed=False debug=False>
should_close = True, kwargs = {}, @py_assert0 = None, @py_assert2 = None

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mcreate_mocked_conn#x1B[39;49;00m(#x1B[90m#x1B[39;49;00m
        conn_closing_result: asyncio.AbstractEventLoop | #x1B[94mNone#x1B[39;49;00m = #x1B[94mNone#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        should_close: #x1B[96mbool#x1B[39;49;00m = #x1B[94mTrue#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
        **kwargs: #x1B[96mobject#x1B[39;49;00m,#x1B[90m#x1B[39;49;00m
    ) -> mock.Mock:#x1B[90m#x1B[39;49;00m
        #x1B[94massert#x1B[39;49;00m #x1B[33m"#x1B[39;49;00m#x1B[33mloop#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m #x1B[95mnot#x1B[39;49;00m #x1B[95min#x1B[39;49;00m kwargs#x1B[90m#x1B[39;49;00m
        #x1B[94mtry#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            loop = asyncio.get_running_loop()#x1B[90m#x1B[39;49;00m
        #x1B[94mexcept#x1B[39;49;00m #x1B[96mRuntimeError#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
>           loop = asyncio.get_running_loop()#x1B[90m#x1B[39;49;00m
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE           RuntimeError: no running event loop#x1B[0m

conn_closing_result = <_UnixSelectorEventLoop running=False closed=False debug=False>
kwargs     = {}
should_close = True

#x1B[1m#x1B[31mtests/test_connector.py#x1B[0m:129: RuntimeError
tests.test_loop::test_default_loop[pyloop]
Stack Traces | 0.062s run time
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>

    #x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_default_loop#x1B[39;49;00m(loop: asyncio.AbstractEventLoop) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
>       #x1B[94massert#x1B[39;49;00m asyncio.get_running_loop() #x1B[95mis#x1B[39;49;00m loop#x1B[90m#x1B[39;49;00m
               ^^^^^^^^^^^^^^^^^^^^^^^^^^#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       RuntimeError: no running event loop#x1B[0m

loop       = <_UnixSelectorEventLoop running=False closed=False debug=False>

#x1B[1m#x1B[31mtests/test_loop.py#x1B[0m:40: RuntimeError
View the full list of 2 ❄️ flaky test(s)
tests.test_loop::test_setup_loop_non_main_thread

Flake rate in main: 4.17% (Passed 23 times, Failed 1 times)

Stack Traces | 0.012s run time
#x1B[0m#x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_setup_loop_non_main_thread#x1B[39;49;00m() -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
        child_exc = #x1B[94mNone#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtarget#x1B[39;49;00m() -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
            #x1B[94mtry#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
                #x1B[94mwith#x1B[39;49;00m loop_context() #x1B[94mas#x1B[39;49;00m loop:#x1B[90m#x1B[39;49;00m
                    #x1B[94massert#x1B[39;49;00m asyncio.get_running_loop() #x1B[95mis#x1B[39;49;00m loop#x1B[90m#x1B[39;49;00m
                    loop.run_until_complete(test_subprocess_co(loop))#x1B[90m#x1B[39;49;00m
            #x1B[94mexcept#x1B[39;49;00m #x1B[96mException#x1B[39;49;00m #x1B[94mas#x1B[39;49;00m exc:  #x1B[90m# pragma: no cover#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
                #x1B[94mnonlocal#x1B[39;49;00m child_exc#x1B[90m#x1B[39;49;00m
                child_exc = exc#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
        #x1B[90m# Ensures setup_test_loop can be called by pytest-xdist in non-main thread.#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
        t = threading.Thread(target=target)#x1B[90m#x1B[39;49;00m
        t.start()#x1B[90m#x1B[39;49;00m
        t.join()#x1B[90m#x1B[39;49;00m
    #x1B[90m#x1B[39;49;00m
>       #x1B[94massert#x1B[39;49;00m child_exc #x1B[95mis#x1B[39;49;00m #x1B[94mNone#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       AssertionError: assert RuntimeError('no running event loop') is None#x1B[0m

child_exc  = RuntimeError('no running event loop')
t          = <Thread(Thread-2 (target), stopped 140574145377984)>
target     = <function test_setup_loop_non_main_thread.<locals>.target at 0x219e4555b80>

#x1B[1m#x1B[31mtests/test_loop.py#x1B[0m:60: AssertionError
tests.test_multipart.TestMultipartResponseWrapper::test_next

Flake rate in main: 4.17% (Passed 23 times, Failed 1 times)

Stack Traces | 0.224s run time
+ Exception Group Traceback (most recent call last):
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t....../site-packages/_pytest/runner.py", line 353, in from_call
  |     result: TResult | None = func()
  |                              ~~~~^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t....../site-packages/_pytest/runner.py", line 245, in <lambda>
  |     lambda: runtest_hook(item=item, **kwds),
  |             ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.../site-packages/pluggy/_hooks.py", line 512, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.../site-packages/pluggy/_manager.py", line 120, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |            ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 167, in _multicall
  |     raise exception
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |     ~~~~~~~~~~~~~~^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.../site-packages/_pytest/logging.py", line 850, in pytest_runtest_call
  |     yield
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |     ~~~~~~~~~~~~~~^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
  |     return result.get_result()
  |            ~~~~~~~~~~~~~~~~~^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.../site-packages/pluggy/_result.py", line 103, in get_result
  |     raise exc.with_traceback(tb)
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
  |     res = yield
  |           ^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |     ~~~~~~~~~~~~~~^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.../site-packages/_pytest/capture.py", line 900, in pytest_runtest_call
  |     return (yield)
  |             ^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |     ~~~~~~~~~~~~~~^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.../site-packages/_pytest/skipping.py", line 268, in pytest_runtest_call
  |     return (yield)
  |             ^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t......................../site-packages/pluggy/_callers.py", line 121, in _multicall
  |     res = hook_impl.function(*args)
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.............../site-packages/_pytest/unraisableexception.py", line 158, in pytest_runtest_call
  |     collect_unraisable(item.config)
  |     ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.............../site-packages/_pytest/unraisableexception.py", line 81, in collect_unraisable
  |     raise ExceptionGroup("multiple unraisable exception warnings", errors)
  | ExceptionGroup: multiple unraisable exception warnings (3 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t/asyncio/base_events.py", line 758, in __del__
    |     _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
    |     ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.............../site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    |     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | pytest.PytestUnraisableExceptionWarning: Exception ignored while calling deallocator <function BaseEventLoop.__del__ at 0x219e03ea980>: None
    | 
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File ".../aiohttp/aiohttp/test_utils.py", line 596, in teardown_test_loop
    |     gc.collect()
    |     ~~~~~~~~~~^^
    | ResourceWarning: unclosed <socket.socket fd=15, family=1, type=1, proto=0>
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.............../site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    |     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | pytest.PytestUnraisableExceptionWarning: Exception ignored while finalizing socket <socket.socket fd=15, family=1, type=1, proto=0>: None
    | 
    +---------------- 3 ----------------
    | Traceback (most recent call last):
    |   File ".../aiohttp/aiohttp/test_utils.py", line 596, in teardown_test_loop
    |     gc.collect()
    |     ~~~~~~~~~~^^
    | ResourceWarning: unclosed <socket.socket fd=16, family=1, type=1, proto=0>
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File ".../hostedtoolcache/Python/3.14.4................................................................../x64-freethreaded/lib/python3.14t.............../site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    |     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | pytest.PytestUnraisableExceptionWarning: Exception ignored while finalizing socket <socket.socket fd=16, family=1, type=1, proto=0>: None
    | 
    +------------------------------------

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 27, 2026

Merging this PR will not alter performance

✅ 67 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing agronholm:replace-get-event-loop (5987883) with master (1842c3e)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 27, 2026

We should do this. I did a few of them previously. Be aware there was pushback when we did some of the others #8555

@agronholm
Copy link
Copy Markdown
Contributor Author

I'm seeing test failures, but most of them seem to be about testing the test harness itself.

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 27, 2026

test failure in https://github.com/aio-libs/aiohttp/actions/runs/24991218031/job/73177192738?pr=12425 are because the CI is relying on the loop being created by the legacy get_event_loop. Probably should be cleaned up in a PR ahead of this.

@webknjaz webknjaz added backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot labels Apr 27, 2026
@webknjaz
Copy link
Copy Markdown
Member

@bdraco do you think this can be considered backportable given that it's not an API change? I've added the labels ahead of time, for now.

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Apr 27, 2026

back port it. There may be some complaints but its past time to get this done and we can't punt on it any longer.

@agronholm
Copy link
Copy Markdown
Contributor Author

Is the consensus then that I need to make another PR to resolve the failures seen here?

@Dreamsorcerer Dreamsorcerer removed the backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot label Apr 27, 2026
@Dreamsorcerer
Copy link
Copy Markdown
Member

I think you can just do them here.
test_loop.py, just delete it, it doesn't make any sense. I already deleted it in #10762 anyway.

Comment thread aiohttp/worker.py
Comment on lines 241 to 243
# Setup uvloop policy, so that every
# asyncio.get_event_loop() will create an instance
# asyncio.get_running_loop() will create an instance
# of uvloop event loop.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment isn't exactly correct, and I think it's fairly obvious what the code does, so let's just delete this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right – I did a fairly simple search/replace operation and missed this nuance.

@Dreamsorcerer
Copy link
Copy Markdown
Member

We should do this. I did a few of them previously. Be aware there was pushback when we did some of the others #8555

Only case I see here that could cause the same problem is in NamedPipeSite, which is a rare thing for users. So, probably won't get any more complaints on this one. Though maybe there's some other way of implementing that check...?

@Dreamsorcerer
Copy link
Copy Markdown
Member

Only case I see here that could cause the same problem is in NamedPipeSite, which is a rare thing for users

A site is generally created after a runner has been setup, so it's also very unlikely to be called in a situation without a running loop:

await runner.setup()
site = web.NamedPipeSite(runner, pipe_name)

@agronholm
Copy link
Copy Markdown
Contributor Author

I just noticed that get_event_loop() function was un-deprecated in Python 3.14. I'm not sure this has any bearing on whether we want this change or not. I should probably update the changelog entry though.

@Dreamsorcerer
Copy link
Copy Markdown
Member

It still has odd behaviour and is discouraged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants