Skip to content

Commit ffe2633

Browse files
Drop has_own_refchain() calls where not needed.
1 parent 203c112 commit ffe2633

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

Objects/object.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,13 @@ refchain_fini(PyInterpreterState *interp)
215215
bool
216216
_PyRefchain_IsTraced(PyInterpreterState *interp, PyObject *obj)
217217
{
218-
if (!has_own_refchain(interp)) {
219-
interp = _PyInterpreterState_Main();
220-
}
221218
return (_Py_hashtable_get(REFCHAIN(interp), obj) == REFCHAIN_VALUE);
222219
}
223220

224221

225222
static void
226223
_PyRefchain_Trace(PyInterpreterState *interp, PyObject *obj)
227224
{
228-
if (!has_own_refchain(interp)) {
229-
interp = _PyInterpreterState_Main();
230-
}
231225
if (_Py_hashtable_set(REFCHAIN(interp), obj, REFCHAIN_VALUE) < 0) {
232226
// Use a fatal error because _Py_NewReference() cannot report
233227
// the error to the caller.
@@ -239,9 +233,6 @@ _PyRefchain_Trace(PyInterpreterState *interp, PyObject *obj)
239233
static void
240234
_PyRefchain_Remove(PyInterpreterState *interp, PyObject *obj)
241235
{
242-
if (!has_own_refchain(interp)) {
243-
interp = _PyInterpreterState_Main();
244-
}
245236
void *value = _Py_hashtable_steal(REFCHAIN(interp), obj);
246237
#ifndef NDEBUG
247238
assert(value == REFCHAIN_VALUE);
@@ -2587,9 +2578,6 @@ _Py_PrintReferences(PyInterpreterState *interp, FILE *fp)
25872578
interp = _PyInterpreterState_Main();
25882579
}
25892580
fprintf(fp, "Remaining objects:\n");
2590-
if (!has_own_refchain(interp)) {
2591-
interp = _PyInterpreterState_Main();
2592-
}
25932581
_Py_hashtable_foreach(REFCHAIN(interp), _Py_PrintReference, fp);
25942582
}
25952583

@@ -2618,9 +2606,6 @@ void
26182606
_Py_PrintReferenceAddresses(PyInterpreterState *interp, FILE *fp)
26192607
{
26202608
fprintf(fp, "Remaining object addresses:\n");
2621-
if (!has_own_refchain(interp)) {
2622-
interp = _PyInterpreterState_Main();
2623-
}
26242609
_Py_hashtable_foreach(REFCHAIN(interp), _Py_PrintReferenceAddress, fp);
26252610
}
26262611

@@ -2700,9 +2685,6 @@ _Py_GetObjects(PyObject *self, PyObject *args)
27002685
.limit = limit,
27012686
};
27022687
PyInterpreterState *interp = _PyInterpreterState_GET();
2703-
if (!has_own_refchain(interp)) {
2704-
interp = _PyInterpreterState_Main();
2705-
}
27062688
int res = _Py_hashtable_foreach(REFCHAIN(interp), _Py_GetObject, &data);
27072689
if (res == _PY_GETOBJECTS_ERROR) {
27082690
Py_DECREF(list);

0 commit comments

Comments
 (0)