Remove and return the frame at the top of the stack.

        :returns: The top frame
        :rtype: Frame
        :raises Exception: If there are no frames on the stack
332382
def pop_frame(self):
        
        self.frames.pop(0)
        if len(self.frames) == 0:
            raise Exception("stack is exhausted")
        return self.frames[0]
257062
def __advice_stack_frame_protection(self, frame):
        

        if frame is None:
            logger.debug(
                'currentframe() returned None; frame protection disabled')
            return

        f_back = frame.f_back
        while f_back:
            if f_back.f_code is self.handle.__code__:
                raise RuntimeError(
                    "indirect invocation of '%s' by 'handle' is forbidden" %
                    frame.f_code.co_name,
                )
            f_back = f_back.f_back
1325478
public static <FRAMETYPE extends WindupVertexFrame> FRAMETYPE removeCurrentPayload(Variables stack,
                Class<FRAMETYPE> type, String name)
                            throws IllegalStateException, IllegalTypeArgumentException
    {
        FRAMETYPE payload = getCurrentPayload(stack, type, name);

        Map<String, Iterable<? extends WindupVertexFrame>> vars = stack.peek();
        vars.remove(name);

        return payload;
    }
156523
public static StackTraceElement myFrame() {
        final Thread me = currentThread();
        StackTraceElement[] se = getAllStackTraces().get(me);
        for (int i = 0; i < se.length; i++) {
            String sClass = se[i].getClassName();
            if (!sClass.equals(CLASS)) continue;
            String method = se[i].getMethodName();
            if (!"myFrame".equals(method)) continue;
            if (i + 1 < se.length) return se[i + 1];
        }
        throw new IllegalStateException("bad stack");
    }
435695
def get_top(self):
        '''
        
        '''
        tops, errors = self.get_tops()
        try:
            merged_tops = self.merge_tops(tops)
        except TypeError as err:
            merged_tops = OrderedDict()
            errors.append('Error encountered while rendering pillar top file.')
        return merged_tops, errors
440404
def root_frame(self, trim_stem=True):
        ''' 
        
        '''
        root_frame = None

        frame_stack = []

        for frame_tuple in self.frame_records:
            identifier_stack = frame_tuple[0]
            time = frame_tuple[1]

            # now we must create a stack of frame objects and assign this time to the leaf
            for stack_depth, frame_identifier in enumerate(identifier_stack):
                if stack_depth < len(frame_stack):
                    if frame_identifier != frame_stack[stack_depth].identifier:
                        # trim any frames after and including this one
                        del frame_stack[stack_depth:]

                if stack_depth >= len(frame_stack):
                    frame = Frame(frame_identifier)
                    frame_stack.append(frame)
                    
                    if stack_depth == 0:
                        # There should only be one root frame, as far as I know
                        assert root_frame is None, ASSERTION_MESSAGE
                        root_frame = frame
                    else:
                        parent = frame_stack[stack_depth-1]
                        parent.add_child(frame)

            # trim any extra frames
            del frame_stack[stack_depth+1:]  # pylint: disable=W0631

            # assign the time to the final frame
            frame_stack[-1].add_child(SelfTimeFrame(self_time=time))
        
        if root_frame is None:
            return None
        
        if trim_stem:
            root_frame = self._trim_stem(root_frame)
        
        return root_frame
1205463
def push(self, item):
        
        if item in self.pushed:
            return
        frame = (item, iter(item[1]))
        self.stack.append(frame)
        self.pushed.add(item)
881276
def move_in_stack(move_up):
    ''''''
    frame = Frame.get_selected_python_frame()
    while frame:
        if move_up:
            iter_frame = frame.older()
        else:
            iter_frame = frame.newer()

        if not iter_frame:
            break

        if iter_frame.is_evalframeex():
            # Result:
            if iter_frame.select():
                iter_frame.print_summary()
            return

        frame = iter_frame

    if move_up:
        print 'Unable to find an older python frame'
    else:
        print 'Unable to find a newer python frame'
1273439
def remove_trace(self, frame=None):
        
        sys.settrace(None)
        if frame is None:
            frame = self.curframe
        while frame and frame is not self.botframe:
            del frame.f_trace
            frame = frame.f_back
1352566
def pop(self):
        

        if self.stack:
            val = self.stack[0]
            self.stack = self.stack[1:]
            return val
        else:
            raise StackError('Stack empty')
1292085
public void clearStack() {
        if (!isValid()) {
            throw new IllegalStateException("accessing top or bottom frame");
        }
        assert slotList.size() >= numLocals;
        if (slotList.size() > numLocals) {
            slotList.subList(numLocals, slotList.size()).clear();
        }
    }
1359407
private void visitFrame(final Frame f) {
        int i, t;
        int nTop = 0;
        int nLocal = 0;
        int nStack = 0;
        int[] locals = f.inputLocals;
        int[] stacks = f.inputStack;
        // computes the number of locals (ignores TOP types that are just after
        // a LONG or a DOUBLE, and all trailing TOP types)
        for (i = 0; i < locals.length; ++i) {
            t = locals[i];
            if (t == Frame.TOP) {
                ++nTop;
            } else {
                nLocal += nTop + 1;
                nTop = 0;
            }
            if (t == Frame.LONG || t == Frame.DOUBLE) {
                ++i;
            }
        }
        // computes the stack size (ignores TOP types that are just after
        // a LONG or a DOUBLE)
        for (i = 0; i < stacks.length; ++i) {
            t = stacks[i];
            ++nStack;
            if (t == Frame.LONG || t == Frame.DOUBLE) {
                ++i;
            }
        }
        // visits the frame and its content
        startFrame(f.owner.position, nLocal, nStack);
        for (i = 0; nLocal > 0; ++i, --nLocal) {
            t = locals[i];
            frame[frameIndex++] = t;
            if (t == Frame.LONG || t == Frame.DOUBLE) {
                ++i;
            }
        }
        for (i = 0; i < stacks.length; ++i) {
            t = stacks[i];
            frame[frameIndex++] = t;
            if (t == Frame.LONG || t == Frame.DOUBLE) {
                ++i;
            }
        }
        endFrame();
    }
9628
def __pop_top_frame(self):
        """"""
        popped = self.__stack.pop()
        if self.__stack:
            self.__stack[-1].process_subframe(popped)
715910
def up(self):
        """"""
        if self.frame:
            self.frame = self.frame.f_back
            return self.frame is None
312150
def pop(self):
        
        res = self._scope_stack.pop()
        self._dlog("popping scope, scope level = {}".format(self.level()))
        self._curr_scope = self._scope_stack[-1]
        return res
924046
def push(self, x):
        
        if isinstance(x, Frame):
            frame = x
        else:
            frame = Frame(x)
        self.stack.append(frame)
        #log.debug('push: (%s)\n%s', Repr(frame), Repr(self.stack))
        return frame
1306421
def stack_trace(depth=None):
    
    frames = inspect.stack()[2:]
    if depth:
        frames = frames[:depth]
        
    result = StringIO()
    result.write("----------------------------------------------------\n")
    for (frame, file, line, context, code, status) in frames:
        result.write("In %s from %s\n%s %s" % (context, file, line, "\n".join(code)))
        result.write("----------------------------------------------------\n")        
    return result.getvalue()