summaryrefslogtreecommitdiffstats
path: root/Python/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/frame.c')
-rw-r--r--Python/frame.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/frame.c b/Python/frame.c
index 89f084b..52f6ef4 100644
--- a/Python/frame.c
+++ b/Python/frame.c
@@ -80,6 +80,7 @@ _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest)
static void
take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
{
+ assert(frame->owner != FRAME_OWNED_BY_CSTACK);
assert(frame->owner != FRAME_OWNED_BY_FRAME_OBJECT);
assert(frame->owner != FRAME_CLEARED);
Py_ssize_t size = ((char*)&frame->localsplus[frame->stacktop]) - (char *)frame;
@@ -99,7 +100,9 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
while (prev && _PyFrame_IsIncomplete(prev)) {
prev = prev->previous;
}
+ frame->previous = NULL;
if (prev) {
+ assert(prev->owner != FRAME_OWNED_BY_CSTACK);
/* Link PyFrameObjects.f_back and remove link through _PyInterpreterFrame.previous */
PyFrameObject *back = _PyFrame_GetFrameObject(prev);
if (back == NULL) {
@@ -111,7 +114,6 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
else {
f->f_back = (PyFrameObject *)Py_NewRef(back);
}
- frame->previous = NULL;
}
if (!_PyObject_GC_IS_TRACKED((PyObject *)f)) {
_PyObject_GC_TRACK((PyObject *)f);