gh-126353: remove implicit creation of loop from get_event_loop#126354
gh-126353: remove implicit creation of loop from get_event_loop#126354kumaraditya303 merged 11 commits intopython:mainfrom
get_event_loop#126354Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Please add also versionchanged directives in the documentation and the What's New entry.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
Update also Doc/library/asyncio-policy.rst. Look if there are other mentions of get_event_loop() that needs to be updated.
Misc/NEWS.d/next/Library/2024-11-03-10-48-07.gh-issue-126353.ChDzot.rst
Outdated
Show resolved
Hide resolved
asvetlov
left a comment
There was a problem hiding this comment.
I was waiting for this date for many years :)
|
|
||
| def test_python_asyncio_debug(self): | ||
| code = "import asyncio; print(asyncio.get_event_loop().get_debug())" | ||
| code = "import asyncio; print(asyncio.new_event_loop().get_debug())" |
There was a problem hiding this comment.
I think this needs a with contextlib.closing(... to prevent the test suite printing a ResourceWarning
|
|
||
| * Removed implicit creation of event loop by :func:`asyncio.get_event_loop`. | ||
| It now raises a :exc:`RuntimeError` if there is no current event loop. | ||
| (Contributed by Kumar Aditya in :gh:`126353`.) |
There was a problem hiding this comment.
Could you please mention what should be used instead?
There was a problem hiding this comment.
new_event_loop(). But these who need a new even loop already know this.
There was a problem hiding this comment.
new_event_loop is not correct, it should be asyncio.run or asyncio.Runner
Worst case it would be asyncio.EventLoop, new_event_loop uses the policy system
…vent_loop` (python#126354) Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
…vent_loop` (python#126354) Remove implicit creation of loop from `asyncio.get_event_loop`. This is a step forward of deprecating the policy system of asyncio.
asyncio.get_event_loop#126353