Skip to content

gh-142518: Add thread safety notes for the buffer protocol - #145911

Merged
lysnikolaou merged 4 commits into
python:mainfrom
lysnikolaou:buffer-protocol-thread-safety
Mar 18, 2026
Merged

gh-142518: Add thread safety notes for the buffer protocol#145911
lysnikolaou merged 4 commits into
python:mainfrom
lysnikolaou:buffer-protocol-thread-safety

Conversation

@lysnikolaou

@lysnikolaoulysnikolaou commented Mar 13, 2026

Copy link
Copy Markdown
Member

Comment threadDoc/c-api/typeobj.rst Outdated

* The export counter decrement in step (1) must be atomic.

* Resource cleanup when the counter reaches zero must be reentrant,

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.

not sure why it needs to be re-entrant, can you give an example?

@lysnikolaoulysnikolaouMar 17, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

What I meant here is that resource cleanup should only happen once. Or, in general, be handled gracefully. Should I update the wording you think?

@kumaraditya303kumaraditya303 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.

One question otherwise LGTM

@lysnikolaoulysnikolaou added the needs backport to 3.14 bugs and security fixes label Mar 18, 2026
@lysnikolaou
lysnikolaou merged commit 847f83e into python:mainMar 18, 2026
30 checks passed
@github-project-automationgithub-project-automationBot moved this from Todo to Done in Docs PRsMar 18, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @lysnikolaou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 18, 2026
…honGH-145911)
(cherry picked from commit 847f83e)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Mar 18, 2026
lysnikolaou added a commit that referenced this pull request Mar 18, 2026
…-145911) (#146106)
(cherry picked from commit 847f83e)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docsDocumentation in the Doc dirskip newstopic-free-threading

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants

@lysnikolaou@kumaraditya303