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

Race with KeyboardInterrupt in asyncio loop run_forever() method #94732

Closed
Labels
@hetmankp

Description

@hetmankp

There is a race with theKeyboardInterrupt exception in theasyncio.base_events.BaseEventLoop.run_forever() method. While an attempt is made to restore the environment to its previous state beforerun_forever() completes with atry...finally, a couple items find themselves outside thetry...finally. Specifically, a badly timedKeyboardInterrupt will mean that, neither theself._thread_id value or the hooks set bysys.set_asyncgen_hooks() will be correctly restored. Both of these should be moved inside thetry...finally.

self._thread_id=threading.get_ident()
old_agen_hooks=sys.get_asyncgen_hooks()
sys.set_asyncgen_hooks(firstiter=self._asyncgen_firstiter_hook,
finalizer=self._asyncgen_finalizer_hook)

This applies to all existing version of Python on all platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp