Skip to content

gh-142518: add thread safety docs on bytes C-API#146415

Merged
kumaraditya303 merged 5 commits intopython:mainfrom
kumaraditya303:bytes
Mar 27, 2026
Merged

gh-142518: add thread safety docs on bytes C-API#146415
kumaraditya303 merged 5 commits intopython:mainfrom
kumaraditya303:bytes

Conversation

@kumaraditya303
Copy link
Copy Markdown
Contributor

@kumaraditya303 kumaraditya303 commented Mar 25, 2026

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

the buffer should not be mutated

Would it better to use must instead? "the buffer must not be mutated".

Or are there some legit use cases to mutate a buffer during a PyBytes function call?

See: https://datatracker.ietf.org/doc/html/rfc2119 for MUST vs SHOULD in RFC.

@kumaraditya303
Copy link
Copy Markdown
Contributor Author

Would it better to use must instead? "the buffer must not be mutated".

Yes, I agree, changed it to "must" instead.

@kumaraditya303 kumaraditya303 requested a review from vstinner March 26, 2026 12:17
@kumaraditya303
Copy link
Copy Markdown
Contributor Author

kumaraditya303 commented Mar 27, 2026

@vstinner I updated the comment to avoid confusion, PTAL at the latest change.

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@kumaraditya303 kumaraditya303 merged commit 6a94980 into python:main Mar 27, 2026
33 checks passed
@kumaraditya303 kumaraditya303 deleted the bytes branch March 27, 2026 13:01
@kumaraditya303 kumaraditya303 added the needs backport to 3.14 bugs and security fixes label Mar 27, 2026
@miss-islington-app
Copy link
Copy Markdown

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 27, 2026
(cherry picked from commit 6a94980)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
@bedevere-app
Copy link
Copy Markdown

bedevere-app bot commented Mar 27, 2026

GH-146515 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 27, 2026
kumaraditya303 added a commit that referenced this pull request Mar 27, 2026
…146515)

gh-142518: add thread safety docs on bytes C-API (GH-146415)
(cherry picked from commit 6a94980)

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