Skip to content

[3.13] gh-127521: Mark list as "shared" before resizing if necessary (GH-127524)#127533

Merged
colesbury merged 1 commit intopython:3.13from
miss-islington:backport-c7dec02-3.13
Dec 3, 2024
Merged

[3.13] gh-127521: Mark list as "shared" before resizing if necessary (GH-127524)#127533
colesbury merged 1 commit intopython:3.13from
miss-islington:backport-c7dec02-3.13

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Dec 2, 2024

In the free threading build, if a non-owning thread resizes a list,
it must use QSBR to free the old list array because there may be a
concurrent access (without a lock) from the owning thread.

To match the pattern in dictobject.c, we just mark the list as "shared"
before resizing if it's from a non-owning thread and not already marked
as shared.
(cherry picked from commit c7dec02)

Co-authored-by: Sam Gross colesbury@gmail.com

…ythonGH-127524)

In the free threading build, if a non-owning thread resizes a list,
it must use QSBR to free the old list array because there may be a
concurrent access (without a lock) from the owning thread.

To match the pattern in dictobject.c, we just mark the list as "shared"
before resizing if it's from a non-owning thread and not already marked
as shared.
(cherry picked from commit c7dec02)

Co-authored-by: Sam Gross <colesbury@gmail.com>
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