Skip to content

Commit 43630d8

Browse files
committed
Tidy up macros
1 parent 215df68 commit 43630d8

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

Include/cpython/object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ without deallocating anything (and so unbounded call-stack depth is avoided).
448448
When the call stack finishes unwinding again, code generated by the END macro
449449
notices this, and calls another routine to deallocate all the objects that
450450
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.
453453
454454
Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base
455455
class, we need to ensure that the trashcan is only triggered on the tp_dealloc

Include/internal/pycore_object.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ _PyObject_GET_WEAKREFS_LISTPTR_FROM_OFFSET(PyObject *op)
600600
return (PyWeakReference **)((char *)op + offset);
601601
}
602602

603-
604603
// Fast inlined version of PyObject_IS_GC()
605604
static inline int
606605
_PyObject_IS_GC(PyObject *obj)

Objects/object.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,8 +2686,6 @@ Py_ReprLeave(PyObject *obj)
26862686

26872687
/* Trashcan support. */
26882688

2689-
#define _PyTrash_UNWIND_LEVEL 50
2690-
26912689
/* Add op to the gcstate->trash_delete_later list. Called when the current
26922690
* call-stack depth gets large. op must be a currently untracked gc'ed
26932691
* object, with refcount 0. Py_DECREF must already have been called on it.
@@ -2723,7 +2721,7 @@ _PyTrash_thread_destroy_chain(PyThreadState *tstate)
27232721
tups = [(tup,) for tup in tups]
27242722
del tups
27252723
*/
2726-
assert(tstate->c_recursion_remaining > 100);
2724+
assert(tstate->c_recursion_remaining > Py_TRASHCAN_HEADROOM);
27272725
tstate->c_recursion_remaining--;
27282726
while (tstate->delete_later) {
27292727
PyObject *op = tstate->delete_later;

0 commit comments

Comments
 (0)