summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2024-06-18 09:45:40 (GMT)
committerGitHub <noreply@github.com>2024-06-18 09:45:40 (GMT)
commit5d997b5d4ef95e1164cb04e4c13d47dd5b71f2ec (patch)
tree8dfd0e522ec6c088ea05705afb56b33b85fd94b1 /Python
parent4b53ea822c0c52fa2f0d62728b6573a120f15574 (diff)
downloadcpython-5d997b5d4ef95e1164cb04e4c13d47dd5b71f2ec.zip
cpython-5d997b5d4ef95e1164cb04e4c13d47dd5b71f2ec.tar.gz
cpython-5d997b5d4ef95e1164cb04e4c13d47dd5b71f2ec.tar.bz2
[3.12] gh-119897: Revert buggy optimization which was removed in 3.13 (#120467)
Diffstat (limited to 'Python')
-rw-r--r--Python/frame.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/Python/frame.c b/Python/frame.c
index a49215f..b84fd9b 100644
--- a/Python/frame.c
+++ b/Python/frame.c
@@ -116,18 +116,6 @@ 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
@@ -147,8 +135,12 @@ _PyFrame_ClearExceptCode(_PyInterpreterFrame *frame)
}
Py_DECREF(f);
}
- _PyFrame_ClearLocals(frame);
+ assert(frame->stacktop >= 0);
+ for (int i = 0; i < frame->stacktop; i++) {
+ Py_XDECREF(frame->localsplus[i]);
+ }
Py_XDECREF(frame->frame_obj);
+ Py_XDECREF(frame->f_locals);
Py_DECREF(frame->f_funcobj);
}