]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-119999: Fix potential race condition in `_Py_ExplicitMergeRefcount` (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 4 Jun 2024 19:57:18 +0000 (21:57 +0200)
committerGitHub <noreply@github.com>
Tue, 4 Jun 2024 19:57:18 +0000 (19:57 +0000)
commit327a36a4f98466e734bf3b10994290fceab8fdd2
tree2d8a7792df438d9d007da41b2fc66d7fffde68ec
parent7edc6bd6276ae857928ee7b0e84817c78292939f
[3.13] gh-119999: Fix potential race condition in `_Py_ExplicitMergeRefcount` (GH-120000) (#120073)

We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`.
Once we mark `ob_ref_shared` as merged, some other thread may free the
object because the caller also passes in `-1` as `extra` to give up its
only reference.
(cherry picked from commit 4055577221f5f52af329e87f31d81bb8fb02c504)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Objects/object.c