GH-139757: Fix reference leaks introduced in GH-140800 (GH-142257)

This commit is contained in:
Mark Shannon 2025-12-04 12:27:15 +00:00 committed by GitHub
parent fb404ab575
commit 6825d5c11d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1228,6 +1228,8 @@ _Py_BuildString_StackRefSteal(
goto cleanup;
}
res = _PyUnicode_JoinArray(&_Py_STR(empty), args_o, total_args);
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
cleanup:
// arguments is a pointer into the GC visible stack,
// so we must NULL out values as we clear them.
@ -1239,8 +1241,6 @@ _Py_BuildString_StackRefSteal(
return res;
}
PyObject *
_Py_BuildMap_StackRefSteal(
_PyStackRef *arguments,
@ -1257,6 +1257,8 @@ _Py_BuildMap_StackRefSteal(
args_o+1, 2,
half_args
);
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
cleanup:
// arguments is a pointer into the GC visible stack,
// so we must NULL out values as we clear them.