'The program object is safe to be deleted after ``finalize``.'

def finalize(self, isa, callconv=0, options=None):

    code_object = drvapi.hsa_code_object_t()
    control_directives = drvapi.hsa_ext_control_directives_t()
    ctypes.memset(ctypes.byref(control_directives), 0, ctypes.sizeof(control_directives))
    hsa.hsa_ext_program_finalize(self._id, isa, callconv, control_directives, options, enums.HSA_CODE_OBJECT_TYPE_PROGRAM, ctypes.byref(code_object))
    return CodeObject(code_object)
