FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-129069: fix more thread safety issues in list by kumaraditya303 · Pull Request #143019 · python/cpython · GitHub

/ cpython Public

gh-129069: fix more thread safety issues in list - #143019

Merged
kumaraditya303 merged 1 commit into
python:mainfrom
kumaraditya303:atomic-list
Dec 22, 2025
Merged

gh-129069: fix more thread safety issues in list#143019
kumaraditya303 merged 1 commit into
python:mainfrom
kumaraditya303:atomic-list

Conversation

kumaraditya303 commented Dec 20, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

This PR fixes thread safety of list.reverse and slice assignment. Also changes stores to use release rather than relaxed as done in #142957.

colesbury 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

I didn't measure any significant performance difference on fastbench on Apple M4.

Microbenchmarks for list.insert are a little slower on that same machine. Here's the benchmark (courtesy of ChatGPT):

https://gist.github.com/colesbury/b675c95d35f29ca9d5723b95396d48a8

Before:

begin   n=100000  reps=1000    total=0.032732s  avg=32.73µs/op
middle  n=100000  reps=1000    total=0.013755s  avg=13.76µs/op
end     n=100000  reps=1000    total=0.000564s  avg=0.56µs/op

After:

begin   n=100000  reps=1000    total=0.048336s  avg=48.34µs/op
middle  n=100000  reps=1000    total=0.019781s  avg=19.78µs/op
end     n=100000  reps=1000    total=0.000191s  avg=0.19µs/op

We could use ptr_wise_atomic_memmove in many of these places, which will probably be faster in the microbenchmarks, but I'm not sure it'll matter in real programs.

kumaraditya303 merged commit 487e91c into python:main Dec 22, 2025
48 checks passed
kumaraditya303 deleted the atomic-list branch December 22, 2025 16:15

bedevere-app Bot commented Jul 16, 2026

Copy link
Copy Markdown

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL