summaryrefslogtreecommitdiff
path: root/jinja2/runtime.py
diff options
context:
space:
mode:
Diffstat (limited to 'jinja2/runtime.py')
-rw-r--r--jinja2/runtime.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/jinja2/runtime.py b/jinja2/runtime.py
index d27ca53..7791c64 100644
--- a/jinja2/runtime.py
+++ b/jinja2/runtime.py
@@ -497,6 +497,15 @@ class Undefined(object):
__float__ = __complex__ = __pow__ = __rpow__ = \
_fail_with_undefined_error
+ def __eq__(self, other):
+ return type(self) is type(other)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __hash__(self):
+ return id(type(self))
+
def __str__(self):
return u''
@@ -563,7 +572,8 @@ class StrictUndefined(Undefined):
"""
__slots__ = ()
__iter__ = __str__ = __len__ = __nonzero__ = __eq__ = \
- __ne__ = __bool__ = Undefined._fail_with_undefined_error
+ __ne__ = __bool__ = __hash__ = \
+ Undefined._fail_with_undefined_error
# remove remaining slots attributes, after the metaclass did the magic they