]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 22 Sep 2022 16:58:35 +0000 (09:58 -0700)
committerGitHub <noreply@github.com>
Thu, 22 Sep 2022 16:58:35 +0000 (09:58 -0700)
commit773dbb9e3a7dc5d4a8560bc3ffb28c16758f159f
treebff0e4101f56f09d68668125d01879a1aa7f3ea1
parentfb87aaafba5a156c4bb8cb326b30984b99fccbfc
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)

The main problem was that an unluckily timed task cancellation could cause
the semaphore to be stuck. There were also doubts about strict FIFO ordering
of tasks allowed to pass.

The Semaphore implementation was rewritten to be more similar to Lock.
Many tests for edge cases (including cancellation) were added.
(cherry picked from commit 24e03796248ab8c7f62d715c28156abe2f1c0d20)

Co-authored-by: Cyker Way <cykerway@gmail.com>
Lib/asyncio/locks.py
Lib/test/test_asyncio/test_locks.py
Misc/NEWS.d/next/Library/2022-05-25-15-57-39.gh-issue-90155.YMstB5.rst [new file with mode: 0644]