Skip to content

Commit 2d079a1

Browse files
committed
Avoid messing with different refcount fields
1 parent 2cb0a82 commit 2d079a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Objects/object.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,7 +2912,7 @@ _PyTrash_thread_deposit_object(PyThreadState *tstate, PyObject *op)
29122912
#ifdef Py_GIL_DISABLED
29132913
op->ob_tid = (uintptr_t)tstate->delete_later;
29142914
#else
2915-
op->ob_refcnt_full = (intptr_t)tstate->delete_later;
2915+
*((PyObject**)op) = tstate->delete_later;
29162916
#endif
29172917
tstate->delete_later = op;
29182918
}
@@ -2931,8 +2931,8 @@ _PyTrash_thread_destroy_chain(PyThreadState *tstate)
29312931
op->ob_tid = 0;
29322932
_Py_atomic_store_ssize_relaxed(&op->ob_ref_shared, _Py_REF_MERGED);
29332933
#else
2934-
tstate->delete_later = (PyObject*) op->ob_refcnt_full;
2935-
op->ob_refcnt_full = 0;
2934+
tstate->delete_later = *((PyObject**)op);
2935+
op->ob_refcnt = 0;
29362936
#endif
29372937

29382938
/* Call the deallocator directly. This used to try to

0 commit comments

Comments
 (0)