Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from the code review.
  • Loading branch information
serhiy-storchaka committed Dec 22, 2022
commit 0feec4c0f5e3cd8a2fe013f6437b1d5ff0fb7736
4 changes: 2 additions & 2 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ an event loop:
running event loop.

If there is no running event loop set, the function will return
the result of ``get_event_loop_policy().get_event_loop()`` call.
the result of the ``get_event_loop_policy().get_event_loop()`` call.

Because this function has rather complex behavior (especially
when custom event loop policies are in use), using the
Expand All @@ -61,7 +61,7 @@ an event loop:

.. deprecated:: 3.12
Deprecation warning is emitted if there is no current event loop.
In future Python releases it will be an error.
In some future Python release it will become an error.

.. function:: set_event_loop(loop)

Expand Down
3 changes: 2 additions & 1 deletion Doc/library/asyncio-policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ asyncio ships with the following built-in policies:
.. deprecated:: 3.12
:meth:`get_event_loop` now emits a :exc:`DeprecationWarning` if there
is no current event loop set and a new event loop has been implicitly
created. In future Python releases it will be an error.
created.
In some future Python release it will become an error.


.. class:: WindowsSelectorEventLoopPolicy
Expand Down
3 changes: 1 addition & 2 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,7 @@ Deprecated

* The :meth:`~asyncio.DefaultEventLoopPolicy.get_event_loop` of the default
event loop policy now emits a :exc:`DeprecationWarning` if there
is no current event loop set and a new event loop has been implicitly
created.
is no current event loop set and it decides to create one.
(Contributed by Serhiy Storchaka and Łukasz Langa in :gh:`100160`.)


Expand Down
2 changes: 2 additions & 0 deletions Lib/asyncio/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@ def get_event_loop(self):
except AttributeError:
pass
else:
# Move up the call stack so that the warning is attached
# to the line outside asyncio itself.
while f:
Comment thread
serhiy-storchaka marked this conversation as resolved.
module = f.f_globals.get('__name__')
if not (module == 'asyncio' or module.startswith('asyncio.')):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Emit a deprecation warning in
:meth:`asyncio.DefaultEventLoopPolicy.get_event_loop` if there is no current
event loop set and a new event loop has been implicitly created.
event loop set and it decides to create one.