Skip to content

gh-155233: Fix asyncio.Barrier reusing a cancelled task's index (alternative to GH-155235) - #158957

Merged
asvetlov merged 9 commits into
python:mainfrom
YvesDup:asyncio.barrier-reuse-index-when-task-cancel
Nov 5, 2026
Merged

asvetlov merged 9 commits into
python:mainfrom
YvesDup:asyncio.barrier-reuse-index-when-task-cancel

Conversation

@YvesDup

@YvesDup YvesDup commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

The returned index counter is now calculated on demand during the draining phasis

See issue for more details

- add a private ``_index`` attr
- add a test

Co-authored-by: Sreehari Annam
@YvesDup YvesDup changed the title gh-155233: Fix asyncio.Barrier reusing a cancelled task's index (alternative to GH-140799) gh-155233: Fix asyncio.Barrier reusing a cancelled task's index (alternative to GH-155235) Oct 7, 2026
@YvesDup
YvesDup marked this pull request as ready for review November 3, 2026 13:28
@YvesDup
YvesDup requested review from 1st1 and asvetlov as code owners November 3, 2026 13:28
@asvetlov

asvetlov commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The idea looks good. Please give me some time for careful review.

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, small nits

Comment thread Lib/asyncio/locks.py Resolved
Comment thread Lib/asyncio/locks.py Resolved
Comment thread Lib/asyncio/locks.py Resolved
Comment thread Lib/asyncio/locks.py Resolved
Comment thread Lib/test/test_asyncio/test_locks.py Resolved
@asvetlov asvetlov added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 5, 2026
Comment thread Lib/asyncio/locks.py Resolved
Comment thread Lib/asyncio/locks.py Resolved
@asvetlov
asvetlov merged commit 49c43f7 into python:main Nov 5, 2026
53 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @YvesDup for the PR, and @asvetlov for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 5, 2026

Copy link
Copy Markdown

GH-161410 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 5, 2026
@bedevere-app

bedevere-app Bot commented Nov 5, 2026

Copy link
Copy Markdown

GH-161411 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 5, 2026
asvetlov added a commit that referenced this pull request Nov 5, 2026
…x (alternative to GH-155235) (GH-158957) (#161410)

gh-155233: Fix asyncio.Barrier reusing a cancelled task's index (alternative to GH-155235) (GH-158957)

* Initial commit:
- add a private ``_index`` attr
- add a test

Co-authored-by: Sreehari Annam

* 📜🤖 Added by blurb_it.

* Apply suggestions from code review

* Update Lib/asyncio/locks.py

* Update Lib/asyncio/locks.py

---------
(cherry picked from commit 49c43f7)

Co-authored-by: Duprat <yduprat@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
asvetlov added a commit that referenced this pull request Nov 5, 2026
…x (alternative to GH-155235) (GH-158957) (#161411)

gh-155233: Fix asyncio.Barrier reusing a cancelled task's index (alternative to GH-155235) (GH-158957)

* Initial commit:
- add a private ``_index`` attr
- add a test

Co-authored-by: Sreehari Annam

* 📜🤖 Added by blurb_it.

* Apply suggestions from code review

* Update Lib/asyncio/locks.py

* Update Lib/asyncio/locks.py

---------
(cherry picked from commit 49c43f7)

Co-authored-by: Duprat <yduprat@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
@YvesDup

YvesDup commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

thank you @asvetlov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants