File tree 3 files changed +3
-6
lines changed
3 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -448,8 +448,8 @@ without deallocating anything (and so unbounded call-stack depth is avoided).
448
448
When the call stack finishes unwinding again, code generated by the END macro
449
449
notices this, and calls another routine to deallocate all the objects that
450
450
may have been added to the list of deferred deallocations. In effect, a
451
- chain of N deallocations is broken into (N-1)/(_PyTrash_UNWIND_LEVEL -1) pieces,
452
- with the call stack never exceeding a depth of _PyTrash_UNWIND_LEVEL .
451
+ chain of N deallocations is broken into (N-1)/(Py_TRASHCAN_HEADROOM -1) pieces,
452
+ with the call stack never exceeding a depth of Py_TRASHCAN_HEADROOM .
453
453
454
454
Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base
455
455
class, we need to ensure that the trashcan is only triggered on the tp_dealloc
Original file line number Diff line number Diff line change @@ -600,7 +600,6 @@ _PyObject_GET_WEAKREFS_LISTPTR_FROM_OFFSET(PyObject *op)
600
600
return (PyWeakReference * * )((char * )op + offset );
601
601
}
602
602
603
-
604
603
// Fast inlined version of PyObject_IS_GC()
605
604
static inline int
606
605
_PyObject_IS_GC (PyObject * obj )
Original file line number Diff line number Diff line change @@ -2686,8 +2686,6 @@ Py_ReprLeave(PyObject *obj)
2686
2686
2687
2687
/* Trashcan support. */
2688
2688
2689
- #define _PyTrash_UNWIND_LEVEL 50
2690
-
2691
2689
/* Add op to the gcstate->trash_delete_later list. Called when the current
2692
2690
* call-stack depth gets large. op must be a currently untracked gc'ed
2693
2691
* object, with refcount 0. Py_DECREF must already have been called on it.
@@ -2723,7 +2721,7 @@ _PyTrash_thread_destroy_chain(PyThreadState *tstate)
2723
2721
tups = [(tup,) for tup in tups]
2724
2722
del tups
2725
2723
*/
2726
- assert (tstate -> c_recursion_remaining > 100 );
2724
+ assert (tstate -> c_recursion_remaining > Py_TRASHCAN_HEADROOM );
2727
2725
tstate -> c_recursion_remaining -- ;
2728
2726
while (tstate -> delete_later ) {
2729
2727
PyObject * op = tstate -> delete_later ;
You can’t perform that action at this time.
0 commit comments