mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
GH-128682: Account for escapes in DECREF_INPUTS
(GH-129953)
* Handle escapes in DECREF_INPUTS * Mark a few more functions as escaping * Replace DECREF_INPUTS with PyStackRef_CLOSE where possible
This commit is contained in:
parent
3e222e3a15
commit
72f56654d0
18 changed files with 2228 additions and 921 deletions
|
@ -2994,6 +2994,11 @@ _Py_Dealloc(PyObject *op)
|
|||
destructor dealloc = type->tp_dealloc;
|
||||
#ifdef Py_DEBUG
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
#ifndef Py_GIL_DISABLED
|
||||
/* This assertion doesn't hold for the free-threading build, as
|
||||
* PyStackRef_CLOSE_SPECIALIZED is not implemented */
|
||||
assert(tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL);
|
||||
#endif
|
||||
PyObject *old_exc = tstate != NULL ? tstate->current_exception : NULL;
|
||||
// Keep the old exception type alive to prevent undefined behavior
|
||||
// on (tstate->curexc_type != old_exc_type) below
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue