8000 Merge implementation of try_reuse_basic_ref · python/cpython@fece88d · GitHub
[go: up one dir, main page]

Skip to content

Commit fece88d

Browse files
committed
Merge implementation of try_reuse_basic_ref
1 parent 37c9529 commit fece88d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Objects/weakrefobject.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,10 @@ try_reuse_basic_ref(PyWeakReference *list, PyTypeObject *type,
353353
cand = proxy;
354354
}
355355

356-
#ifdef Py_GIL_DISABLED
357-
if (cand != NULL && !_Py_TryIncref((PyObject *) cand)) {
358-
cand = NULL;
356+
if (cand != NULL && _Py_TryIncref((PyObject *) cand)) {
357+
return cand;
359358
}
360-
#else
361-
Py_XINCREF(cand);
362-
#endif
363-
364-
return cand;
359+
return NULL;
365360
}
366361

367362
static int

0 commit comments

Comments
 (0)
0