Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DeprecationWarning scope expanded in asyncio.events #100160

Closed
Assignees
serhiy-storchaka
Labels
@jaraco

Description

@jaraco

As discovered inprompt-toolkit/python-prompt-toolkit#1696, it appears that the DeprecationWarning introduced in Python 3.10 has expanded its scope, now with 3.11.1 and 3.10.9 emitting during get_event_loop_policy() where it did not before:

 ~ $ py -3.11 -W errorPython 3.11.0 (main, Oct 26 2022, 19:06:18) [Clang 14.0.0 (clang-1400.0.29.202)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> import asyncio>>> asyncio.get_event_loop_policy().get_event_loop()<_UnixSelectorEventLoop running=False closed=False debug=False>>>> ^D ~ $ docker run -it jaraco/multipy-tox py -3.11 -W errorPython 3.11.1 (main, Dec  7 2022, 01:11:34) [GCC 11.3.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import asyncio>>> asyncio.get_event_loop_policy().get_event_loop()Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/usr/lib/python3.11/asyncio/events.py", line 687, in get_event_loop    warnings.warn('There is no current event loop',DeprecationWarning: There is no current event loop

It's not obvious if it was intentional to expand the scope of the DeprecationWarning, but it does come as a surprise as the calling code had previously attempted to address the deprecation.

I think there are two concerns to be addressed:

  • Does this symptom indicate an unintentional but real additional path that was previously unprotected by the DeprecationWarning? And if so, does that imply that the behavior's first true deprecation is in Python 3.12 and thus will delay the removal?
  • What is a user expected to do to properly address the deprecation? I read thewhat's new for Python 3.10 and it indicates that the call is deprecated, but it provides little guidance on how a user can adapt to the new behavior. Maybe there should be a note to the effect of "programs relying on a non-running event loop must ensure that there is a running event loop before attempting to get the event loop."

Linked PRs

Metadata

Metadata

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp