def introspect():
    """pointer on top of value stack is id of the object about to be returned
    FIXME adjust for sum(vars, locals) in the introspected function
    """
    fr = inspect.stack()[1][0]
    print "caught", id2obj(ctypes.cast(id(fr), ctypes.POINTER(ctypes.c_ulong))[47])
pointer on top of value stack is id of the object about to be returned
    FIXME adjust for sum(vars, locals) in the introspected function
    
recipes/Python/578412_Peek_at_Python_value_stack/recipe-578412.py