Skip to content

Commit b42af37

Browse files
GH-138355: Remove trash_delete_later from _gc_runtime_state (#138767)
Remove trash_delete_later and trash_delete_nesting from _gc_runtime_state.
1 parent d873fb4 commit b42af37

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Include/cpython/pystate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ struct _ts {
157157
*/
158158
unsigned long native_thread_id;
159159

160+
/* List of objects that still need to be cleaned up, singly linked
161+
* via their gc headers' gc_next pointers. The list is populated by
162+
* _PyTrash_thread_deposit_object and cleaned up by
163+
* _PyTrash_thread_destroy_chain.
164+
*/
160165
PyObject *delete_later;
161166

162167
/* Tagged pointer to top-most critical section, or zero if there is no

Include/internal/pycore_interp_structs.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,6 @@ enum _GCPhase {
203203
#define NUM_GENERATIONS 3
204204

205205
struct _gc_runtime_state {
206-
/* List of objects that still need to be cleaned up, singly linked
207-
* via their gc headers' gc_prev pointers. */
208-
PyObject *trash_delete_later;
209-
/* Current call-stack depth of tp_dealloc calls. */
210-
int trash_delete_nesting;
211-
212206
/* Is automatic collection enabled? */
213207
int enabled;
214208
int debug;

Objects/object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3051,7 +3051,7 @@ Py_ReprLeave(PyObject *obj)
30513051

30523052
/* Trashcan support. */
30533053

3054-
/* Add op to the gcstate->trash_delete_later list. Called when the current
3054+
/* Add op to the tstate->delete_later list. Called when the current
30553055
* call-stack depth gets large. op must be a gc'ed object, with refcount 0.
30563056
* Py_DECREF must already have been called on it.
30573057
*/
@@ -3077,7 +3077,7 @@ _PyTrash_thread_deposit_object(PyThreadState *tstate, PyObject *op)
30773077
tstate->delete_later = op;
30783078
}
30793079

3080-
/* Deallocate all the objects in the gcstate->trash_delete_later list.
3080+
/* Deallocate all the objects in the tstate->delete_later list.
30813081
* Called when the call-stack unwinds again. */
30823082
void
30833083
_PyTrash_thread_destroy_chain(PyThreadState *tstate)

0 commit comments

Comments
 (0)