trepan/lib/stack.py
def get_call_function_name(frame):
    """If f_back is looking at a call function, return
    the name for it. Otherwise return None"""
    f_back = frame.f_back
    if not f_back: return None
    if 'CALL_FUNCTION' != Mbytecode.op_at_frame(f_back): return None

    co         = f_back.f_code
    code       = co.co_code
    # labels     = dis.findlabels(code)
    linestarts = dict(dis.findlinestarts(co))
    offset     = f_back.f_lasti
    while offset >= 0:
        if offset in linestarts:
            op = code[offset]
            offset += 1
            arg = code[offset]
            # FIXME: put this code in xdis
            extended_arg = 0
            while True:
                if PYTHON_VERSION >= 3.6:
                    if op == opc.EXTENDED_ARG:
                        extended_arg += (arg << 8)
                        continue
                    arg = code[offset] + extended_arg
                    # FIXME: Python 3.6.0a1 is 2, for 3.6.a3 we have 1
                else:
                    if op == opc.EXTENDED_ARG:
                        extended_arg += (arg << 256)
                        continue
                    arg = code[offset] + code[offset+1]*256 + extended_arg
                break

            return co.co_names[arg]
        offset -= 1
        pass
    return None
def get_call_function_name(frame):
    f_back = frame.f_back
    if not f_back: return None
    if 'CALL_FUNCTION' != Mbytecode.op_at_frame(f_back): return None

    co         = f_back.f_code
    code       = co.co_code
    # labels     = dis.findlabels(code)
    linestarts = dict(dis.findlinestarts(co))
    offset     = f_back.f_lasti
    while offset >= 0:
        if offset in linestarts:
            op = code[offset]
            offset += 1
            arg = code[offset]
            # FIXME: put this code in xdis
            extended_arg = 0
            while True:
                if PYTHON_VERSION >= 3.6:
                    if op == opc.EXTENDED_ARG:
                        extended_arg += (arg << 8)
                        continue
                    arg = code[offset] + extended_arg
                    # FIXME: Python 3.6.0a1 is 2, for 3.6.a3 we have 1
                else:
                    if op == opc.EXTENDED_ARG:
                        extended_arg += (arg << 256)
                        continue
                    arg = code[offset] + code[offset+1]*256 + extended_arg
                break

            return co.co_names[arg]
        offset -= 1
        pass
    return None
def get_call_function_name ( frame ) : f_back = frame . f_back if not f_back : return None if 'CALL_FUNCTION' != Mbytecode . op_at_frame ( f_back ) : return None co = f_back . f_code code = co . co_code # labels     = dis.findlabels(code) linestarts = dict ( dis . findlinestarts ( co ) ) offset = f_back . f_lasti while offset >= 0 : if offset in linestarts : op = code [ offset ] offset += 1 arg = code [ offset ] # FIXME: put this code in xdis extended_arg = 0 while True : if PYTHON_VERSION >= 3.6 : if op == opc . EXTENDED_ARG : extended_arg += ( arg << 8 ) continue arg = code [ offset ] + extended_arg # FIXME: Python 3.6.0a1 is 2, for 3.6.a3 we have 1 else : if op == opc . EXTENDED_ARG : extended_arg += ( arg << 256 ) continue arg = code [ offset ] + code [ offset + 1 ] * 256 + extended_arg break return co . co_names [ arg ] offset -= 1 pass return None
If f_back is looking at a call function, return
    the name for it. Otherwise return None
If f_back is looking at a call function return the name for it . Otherwise return None