From f0fd65c8ceb0d41a5d1ce57c488acc176170c3bf Mon Sep 17 00:00:00 2001 From: xFrednet Date: Tue, 3 Mar 2026 11:53:15 +0100 Subject: [PATCH] Regions: Correct `_PyRegion_AddRefsArray()` write barrier --- Python/region.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Python/region.c b/Python/region.c index dcd97ead89a3a1..62b13a5975b554 100644 --- a/Python/region.c +++ b/Python/region.c @@ -2228,14 +2228,14 @@ int _PyRegion_AddRefs(PyObject *src, int argc, ...) { int _PyRegion_AddRefsArray(PyObject *src, int tgt_count, PyObject** tgt_array) { Py_region_t src_region = _PyRegion_Get(src); - // Stage local references + // Stage references + PyRegion_staged_ref_t staged_ref; if (IS_LOCAL_REGION(src_region)) { - return _stage_local_refs(src, tgt_count, tgt_array); + staged_ref = _stage_local_refs(src, tgt_count, tgt_array); + } else { + staged_ref = regiondata_stage_objects(src_region, src, tgt_count, tgt_array, NULL); } - // Stage the references to be added - PyRegion_staged_ref_t staged_ref = regiondata_stage_objects(src_region, src, tgt_count, tgt_array, NULL); - if (staged_ref == PyRegion_staged_ref_ERR) { return -1; }