def getargs(co):
    """Get information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where 'args' is
    a list of argument names (possibly containing nested lists), and
    'varargs' and 'varkw' are the names of the * and ** arguments or None."""
    if not iscode(co): raise TypeError, 'arg is not a code object'

    nargs = co.co_argcount
    names = co.co_varnames
    args = list(names[:nargs])
    step = 0

    # The following acrobatics are for anonymous (tuple) arguments.
    if not sys.platform.startswith('java'):#Jython doesn't have co_code
        code = co.co_code
        import dis
        for i in range(nargs):
            if args[i][:1] in ['', '.']:
                stack, remain, count = [], [], []
                while step < len(code):
                    op = ord(code[step])
                    step = step + 1
                    if op >= dis.HAVE_ARGUMENT:
                        opname = dis.opname[op]
                        value = ord(code[step]) + ord(code[step + 1]) * 256
                        step = step + 2
                        if opname in ['UNPACK_TUPLE', 'UNPACK_SEQUENCE']:
                            remain.append(value)
                            count.append(value)
                        elif opname == 'STORE_FAST':
                            stack.append(names[value])
                            remain[-1] = remain[-1] - 1
                            while remain[-1] == 0:
                                remain.pop()
                                size = count.pop()
                                stack[-size:] = [stack[-size:]]
                                if not remain: break
                                remain[-1] = remain[-1] - 1
                            if not remain: break
                args[i] = stack[0]

    varargs = None
    if co.co_flags & CO_VARARGS:
        varargs = co.co_varnames[nargs]
        nargs = nargs + 1
    varkw = None
    if co.co_flags & CO_VARKEYWORDS:
        varkw = co.co_varnames[nargs]
    return args, varargs, varkw
Get information about the arguments accepted by a code object.

    Three things are returned: (args, varargs, varkw), where 'args' is
    a list of argument names (possibly containing nested lists), and
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
debugger/src/_pydev_imps/_pydev_inspect.py