Why return {'CANCELLED''} didn't cancel the operation?

In this documentation, appears the code below:

        elif event.type in ('RIGHTMOUSE', 'ESC'):  # Cancel
            return {'CANCELLED'}

I thought this is to say, if I click right mouse button or press ESC key, the operation will be cancelled. But running this script, I saw that it confirmed the operation, the object was moved. (Try it yourself, the complete script is listed below) Why is the operation not cancelled?


import bpy
class ModalOperator(bpy.types.Operator):
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"
    def __init__(self):
        print("Start")
    def __del__(self):
        print("End")
    def execute(self, context):
        context.object.location.x = self.value / 100.0
        return {'FINISHED'}
    def modal(self, context, event):
        if event.type == 'MOUSEMOVE':  # Apply
            self.value = event.mouse_x
            self.execute(context)
        elif event.type == 'LEFTMOUSE':  # Confirm
            return {'FINISHED'}
        elif event.type in ('RIGHTMOUSE', 'ESC'):  # Cancel
            return {'CANCELLED'}
        return {'RUNNING_MODAL'}
    def invoke(self, context, event):
        self.value = event.mouse_x
        self.execute(context)
        print(context.window_manager.modal_handler_add(self))
        return {'RUNNING_MODAL'}


bpy.utils.register_class(ModalOperator)

# test call
bpy.ops.object.modal_operator('INVOKE_DEFAULT')

Oh! I see, the changed data must be restored manually.

Then what’s the point telling blender “CANCELLED” if there’s no reaction to it?

And what is the point to set the bl_options “undo” if it can always be undone?