GH-130396: Increase trashcan overhead (GH-130552)

Double trashcan overhead
This commit is contained in:
Mark Shannon 2025-02-26 08:54:24 +00:00 committed by GitHub
parent 59d3ad0c62
commit 263d56e1e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -494,13 +494,13 @@ PyAPI_FUNC(int) _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int m
#define Py_TRASHCAN_BEGIN(op, dealloc) \ #define Py_TRASHCAN_BEGIN(op, dealloc) \
do { \ do { \
PyThreadState *tstate = PyThreadState_Get(); \ PyThreadState *tstate = PyThreadState_Get(); \
if (_Py_ReachedRecursionLimitWithMargin(tstate, 1) && Py_TYPE(op)->tp_dealloc == (destructor)dealloc) { \ if (_Py_ReachedRecursionLimitWithMargin(tstate, 2) && Py_TYPE(op)->tp_dealloc == (destructor)dealloc) { \
_PyTrash_thread_deposit_object(tstate, (PyObject *)op); \ _PyTrash_thread_deposit_object(tstate, (PyObject *)op); \
break; \ break; \
} }
/* The body of the deallocator is here. */ /* The body of the deallocator is here. */
#define Py_TRASHCAN_END \ #define Py_TRASHCAN_END \
if (tstate->delete_later && !_Py_ReachedRecursionLimitWithMargin(tstate, 2)) { \ if (tstate->delete_later && !_Py_ReachedRecursionLimitWithMargin(tstate, 4)) { \
_PyTrash_thread_destroy_chain(tstate); \ _PyTrash_thread_destroy_chain(tstate); \
} \ } \
} while (0); } while (0);