- Fixed lack of Python 3 support for bytecode caches.
- Reverted support for defining blocks in included templates as this
broke existing templates for users.
+- Fixed some warnings with hashing of undefineds and nodes if Python
+ is run with warnings for Python 3.
+- Added support for properly hashing undefined objects.
Version 2.7
-----------
def __ne__(self, other):
return not self.__eq__(other)
+ # Restore Python 2 hashing behavior on Python 3
+ __hash__ = object.__hash__
+
def __repr__(self):
return '%s(%s)' % (
self.__class__.__name__,
__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''
"""
__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