Skip to content

Commit

Permalink
Merge implementation of try_reuse_basic_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
mpage committed Mar 29, 2024
1 parent 37c9529 commit fece88d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions Objects/weakrefobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,10 @@ try_reuse_basic_ref(PyWeakReference *list, PyTypeObject *type,
cand = proxy;
}

#ifdef Py_GIL_DISABLED
if (cand != NULL && !_Py_TryIncref((PyObject *) cand)) {
cand = NULL;
if (cand != NULL && _Py_TryIncref((PyObject *) cand)) {
return cand;
}
#else
Py_XINCREF(cand);
#endif

return cand;
return NULL;
}

static int
Expand Down

0 comments on commit fece88d

Please sign in to comment.