Skip to content

gh-128759: Fix accesses to tp_version_tag.#129750

Merged
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-128759-tp-version-tag
Feb 12, 2025
Merged

gh-128759: Fix accesses to tp_version_tag.#129750
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-128759-tp-version-tag

Conversation

@colesbury

@colesbury colesbury commented Feb 6, 2025

Copy link
Copy Markdown
Contributor

We should use a relaxed atomic load in the free threading build in PyType_Modified() because that's called without the type lock held. It's not necessary to use atomics in type_modified_unlocked().

We should also use FT_ATOMIC_STORE_UINT_RELAXED() instead of the UINT32 variant because tp_version_tag is declared as unsigned int.

We should use a relaxed atomic load in the free threading build in
`PyType_Modified()` because that's called without the type lock held.
It's not necessary to use atomics in `type_modified_unlocked()`.

We should also use `FT_ATOMIC_STORE_UINT_RELAXED()` instead of the
`UINT32` variant because `tp_version_tag` is declared as `unsigned int`.
Comment thread Objects/typeobject.c
@colesbury
colesbury merged commit 57f45ee into python:main Feb 12, 2025
@colesbury
colesbury deleted the gh-128759-tp-version-tag branch February 12, 2025 14:34
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

Sorry, @colesbury, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 57f45ee2d8ee23c2a1d1daba4095a5a044169419 3.13

colesbury added a commit to colesbury/cpython that referenced this pull request Feb 12, 2025
…29750)

We should use a relaxed atomic load in the free threading build in
`PyType_Modified()` because that's called without the type lock held.
It's not necessary to use atomics in `type_modified_unlocked()`.

We should also use `FT_ATOMIC_STORE_UINT_RELAXED()` instead of the
`UINT32` variant because `tp_version_tag` is declared as `unsigned int`.
(cherry picked from commit 57f45ee)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app

bedevere-app Bot commented Feb 12, 2025

Copy link
Copy Markdown

GH-130042 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Feb 12, 2025
colesbury added a commit that referenced this pull request Feb 12, 2025
…30042)

We should use a relaxed atomic load in the free threading build in
`PyType_Modified()` because that's called without the type lock held.
It's not necessary to use atomics in `type_modified_unlocked()`.

We should also use `FT_ATOMIC_STORE_UINT_RELAXED()` instead of the
`UINT32` variant because `tp_version_tag` is declared as `unsigned int`.
(cherry picked from commit 57f45ee)
@colesbury colesbury removed their assignment Feb 14, 2025
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