GH-124715: Move trashcan mechanism into Py_Dealloc (GH-132280)

This commit is contained in:
Mark Shannon 2025-04-30 11:37:53 +01:00 committed by GitHub
parent 0f23e84cda
commit 44e4c479fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 88 additions and 196 deletions

View file

@ -26,17 +26,25 @@ PyAPI_DATA(int) (*PyOS_InputHook)(void);
* apart. In practice, that means it must be larger than the C
* stack consumption of PyEval_EvalDefault */
#if defined(_Py_ADDRESS_SANITIZER) || defined(_Py_THREAD_SANITIZER)
# define PYOS_STACK_MARGIN 4096
# define PYOS_LOG2_STACK_MARGIN 12
#elif defined(Py_DEBUG) && defined(WIN32)
# define PYOS_STACK_MARGIN 4096
# define PYOS_LOG2_STACK_MARGIN 12
#elif defined(__wasi__)
/* Web assembly has two stacks, so this isn't really a size */
# define PYOS_STACK_MARGIN 500
# define PYOS_LOG2_STACK_MARGIN 9
#else
# define PYOS_STACK_MARGIN 2048
# define PYOS_LOG2_STACK_MARGIN 11
#endif
#define PYOS_STACK_MARGIN (1 << PYOS_LOG2_STACK_MARGIN)
#define PYOS_STACK_MARGIN_BYTES (PYOS_STACK_MARGIN * sizeof(void *))
#if SIZEOF_VOID_P == 8
#define PYOS_STACK_MARGIN_SHIFT (PYOS_LOG2_STACK_MARGIN + 3)
#else
#define PYOS_STACK_MARGIN_SHIFT (PYOS_LOG2_STACK_MARGIN + 2)
#endif
#if defined(WIN32)
#define USE_STACKCHECK
#endif