Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 15, 2024

We should maintain the invariant that a zero ob_tid implies the
refcount fields are merged.

  • Move the assignment in _Py_MergeZeroLocalRefcount to immediately
    before the refcount merge.
  • Update _PyTrash_thread_destroy_chain to set ob_ref_shared to
    _Py_REF_MERGED when setting ob_tid to zero.

Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
(cherry picked from commit d23be39)

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

…honGH-121799)

We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.

* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
  before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
  `_Py_REF_MERGED` when setting `ob_tid` to zero.

Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
(cherry picked from commit d23be39)

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