From b11a951f16f0603d98de24fee5c023df83ea552c Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Fri, 21 May 2021 10:57:35 +0100 Subject: bpo-44032: Move data stack to thread from FrameObject. (GH-26076) * Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames. * Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells. * Move locals, cells and freevars out of frame object into separate memory buffer. * Use per-threadstate allocated memory chunks for local variables. * Move globals and builtins from frame object to per-thread stack. * Move (slow) locals frame object to per-thread stack. * Move internal frame functions to internal header. --- Python/suggestions.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Python/suggestions.c') diff --git a/Python/suggestions.c b/Python/suggestions.c index 6fb01f10cd3..2e76551f363 100644 --- a/Python/suggestions.c +++ b/Python/suggestions.c @@ -1,5 +1,6 @@ #include "Python.h" #include "frameobject.h" +#include "pycore_frame.h" #include "pycore_pyerrors.h" @@ -208,9 +209,10 @@ offer_suggestions_for_name_error(PyNameErrorObject *exc) PyFrameObject *frame = traceback->tb_frame; assert(frame != NULL); - PyCodeObject *code = frame->f_code; + PyCodeObject *code = PyFrame_GetCode(frame); assert(code != NULL && code->co_varnames != NULL); PyObject *dir = PySequence_List(code->co_varnames); + Py_DECREF(code); if (dir == NULL) { return NULL; } @@ -221,7 +223,7 @@ offer_suggestions_for_name_error(PyNameErrorObject *exc) return suggestions; } - dir = PySequence_List(frame->f_globals); + dir = PySequence_List(_PyFrame_GetGlobals(frame)); if (dir == NULL) { return NULL; } @@ -231,7 +233,7 @@ offer_suggestions_for_name_error(PyNameErrorObject *exc) return suggestions; } - dir = PySequence_List(frame->f_builtins); + dir = PySequence_List(_PyFrame_GetBuiltins(frame)); if (dir == NULL) { return NULL; } -- cgit v1.2.3