summaryrefslogtreecommitdiff
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:09:03 +0100
committerNick Coghlan <ncoghlan@gmail.com>2017-02-09 16:09:03 +0100
commit2a1d833d5da7fa7a01a2eef183b0a208ed019427 (patch)
tree8da3ebb695ae55c69d0a58691403fb13d96a9476 /Objects/frameobject.c
parentc6180bb73c8c7c7f9d8ea9816487b710597b6fc1 (diff)
parentbbd3587a29510bd5a318e0a19fc8570c0cd3b622 (diff)
downloadcpython-2a1d833d5da7fa7a01a2eef183b0a208ed019427.tar.gz
Merge issue #26355 fix from 3.6
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 62f9f34c8e..84483195ab 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -409,13 +409,15 @@ static int numfree = 0; /* number of frames currently in free_list */
/* max value for numfree */
#define PyFrame_MAXFREELIST 200
-static void
+static void _Py_HOT_FUNCTION
frame_dealloc(PyFrameObject *f)
{
PyObject **p, **valuestack;
PyCodeObject *co;
- PyObject_GC_UnTrack(f);
+ if (_PyObject_GC_IS_TRACKED(f))
+ _PyObject_GC_UNTRACK(f);
+
Py_TRASHCAN_SAFE_BEGIN(f)
/* Kill all local variables */
valuestack = f->f_valuestack;
@@ -605,9 +607,9 @@ int _PyFrame_Init()
return 1;
}
-PyFrameObject *
-PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
- PyObject *locals)
+PyFrameObject* _Py_HOT_FUNCTION
+_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code,
+ PyObject *globals, PyObject *locals)
{
PyFrameObject *back = tstate->frame;
PyFrameObject *f;
@@ -727,10 +729,20 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
f->f_executing = 0;
f->f_gen = NULL;
- _PyObject_GC_TRACK(f);
return f;
}
+PyFrameObject*
+PyFrame_New(PyThreadState *tstate, PyCodeObject *code,
+ PyObject *globals, PyObject *locals)
+{
+ PyFrameObject *f = _PyFrame_New_NoTrack(tstate, code, globals, locals);
+ if (f)
+ _PyObject_GC_TRACK(f);
+ return f;
+}
+
+
/* Block management */
void