diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-07-02 22:47:57 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2024-07-02 22:59:47 +0300 |
commit | 96b239778766d32d5158aca805e08199b3c0a743 (patch) | |
tree | a9c8679261a62138ec4735d878a11f6478cd196a /contrib/tools/python3/Python/frame.c | |
parent | 292e7317266c2136a1e1bd027e16e6eefb639028 (diff) | |
download | ydb-96b239778766d32d5158aca805e08199b3c0a743.tar.gz |
Update contrib/tools/python3 to 3.12.4
6e8edffbef193b35b45ddccdc3beda6bb2627186
Diffstat (limited to 'contrib/tools/python3/Python/frame.c')
-rw-r--r-- | contrib/tools/python3/Python/frame.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/tools/python3/Python/frame.c b/contrib/tools/python3/Python/frame.c index b84fd9b6a9..a49215fa44 100644 --- a/contrib/tools/python3/Python/frame.c +++ b/contrib/tools/python3/Python/frame.c @@ -116,6 +116,18 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame) } void +_PyFrame_ClearLocals(_PyInterpreterFrame *frame) +{ + assert(frame->stacktop >= 0); + int stacktop = frame->stacktop; + frame->stacktop = 0; + for (int i = 0; i < stacktop; i++) { + Py_XDECREF(frame->localsplus[i]); + } + Py_CLEAR(frame->f_locals); +} + +void _PyFrame_ClearExceptCode(_PyInterpreterFrame *frame) { /* It is the responsibility of the owning generator/coroutine @@ -135,12 +147,8 @@ _PyFrame_ClearExceptCode(_PyInterpreterFrame *frame) } Py_DECREF(f); } - assert(frame->stacktop >= 0); - for (int i = 0; i < frame->stacktop; i++) { - Py_XDECREF(frame->localsplus[i]); - } + _PyFrame_ClearLocals(frame); Py_XDECREF(frame->frame_obj); - Py_XDECREF(frame->f_locals); Py_DECREF(frame->f_funcobj); } |