def _disallow_catching_UnicodeDecodeError(f):
    """
    Patches a template modules to prevent catching UnicodeDecodeError.

    Note that this has the effect of also making Template raise a
    UnicodeDecodeError instead of a TemplateEncodingError if the template
    string is not UTF-8 or unicode.
    """
    patch_base = patch.object(VariableNode, 'render', variable_node_render)
    patch_all = patch_base
    if django.VERSION < (1, 9):
        from django.template.debug import DebugVariableNode
        patch_debug = patch.object(
            DebugVariableNode, 'render', debug_variable_node_render)
        patch_all = _compose(patch_all, patch_debug)
    return patch_all(f)
Patches a template modules to prevent catching UnicodeDecodeError.

    Note that this has the effect of also making Template raise a
    UnicodeDecodeError instead of a TemplateEncodingError if the template
    string is not UTF-8 or unicode.