diff options
author | Benjamin Peterson <benjamin@python.org> | 2017-01-31 23:31:20 -0800 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2017-01-31 23:31:20 -0800 |
commit | 75a56cd1847142d9c893b6df5fb674f54b34d9ed (patch) | |
tree | 73d254a7d8ed4bc2f76293a2b2e223c3f48e7dd4 /Objects/frameobject.c | |
parent | bff21dc9e43eaf9549abe72a32d98a6c20de8c5b (diff) | |
parent | fcd15724f28a5249f13690af32dc12628ab186c6 (diff) | |
download | cpython-75a56cd1847142d9c893b6df5fb674f54b34d9ed.tar.gz |
merge 3.6 (#29398)
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r-- | Objects/frameobject.c | 24 |
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 |