Skip to content

Commit

Permalink
resolve merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eendebakpt committed Aug 27, 2024
1 parent cc3e3cb commit 29b39d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,12 @@ static inline void _Py_RefcntAdd(PyObject* op, Py_ssize_t n)
static inline int
_PyObject_IsUniquelyReferenced(PyObject *ob)
{
/* Function to check whether an immutable object such as a tuple can be
* modified inplace by the owning method
*/
#if !defined(Py_GIL_DISABLED)
return Py_REFCNT(ob) == 1;
#else
// NOTE: the entire ob_ref_shared field must be zero, including flags, to
// ensure that other threads cannot concurrently create new references to
// this object.
// this object.
return (_Py_IsOwnedByCurrentThread(ob) &&
_Py_atomic_load_uint32_relaxed(&ob->ob_ref_local) == 1 &&
_Py_atomic_load_ssize_relaxed(&ob->ob_ref_shared) == 0);
Expand Down
2 changes: 1 addition & 1 deletion Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2972,7 +2972,7 @@ zip_next(zipobject *lz)
if (tuplesize == 0)
return NULL;

if (_Py_Reuse_Immutable_Object(result)) {
if (_PyObject_IsUniquelyReferenced(result)) {
Py_INCREF(result);
for (i=0 ; i < tuplesize ; i++) {
it = PyTuple_GET_ITEM(lz->ittuple, i);
Expand Down

0 comments on commit 29b39d2

Please sign in to comment.