Skip to content

gh-145036: Fix data race for list capacity#145365

Merged
kumaraditya303 merged 6 commits intopython:mainfrom
bkap123:list-thread-race
Mar 10, 2026
Merged

gh-145036: Fix data race for list capacity#145365
kumaraditya303 merged 6 commits intopython:mainfrom
bkap123:list-thread-race

Conversation

@bkap123
Copy link
Contributor

@bkap123 bkap123 commented Feb 28, 2026

Changes list___sizeof___impl to use list_capacity() when determining size of a list object in order to prevent a data race.

Also, not exactly sure what to do for a test. The current test fails on main only when configured with TSan. Any feedback/suggestions would be greatly appreciated.

…e-145036.70Kbfz.rst

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
…e-145036.70Kbfz.rst

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@kumaraditya303 kumaraditya303 merged commit 9e08023 into python:main Mar 10, 2026
89 of 91 checks passed
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

Sorry, @bkap123 and @kumaraditya303, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 9e0802330caca51fed7fc0c8c1dcce2daf03d8bd 3.14

@bkap123 bkap123 deleted the list-thread-race branch March 10, 2026 17:03
bkap123 added a commit to bkap123/cpython that referenced this pull request Mar 12, 2026
…ding (pythonGH-145365)

(cherry picked from commit 9e08023)

Co-authored-by: bkap123 <97006829+bkap123@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Mar 12, 2026

GH-145881 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 Mar 12, 2026
colesbury pushed a commit that referenced this pull request Mar 13, 2026
…H-145365) (#145881)

(cherry picked from commit 9e08023)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants