Skip to content
Myr

Fixed warnings if Python is run with -3.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This also adds proper hashing and comparision support to undefined objects. This fixes #224

authored by Armin Ronacher · committed by Armin Ronacher · parent ad09fe3 · Browse files · 3 files+17 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+17 added−1 removed

  • other:+17 added−1 removed

3 files+17 added−1 removed

modified:jinja2/nodes.py+3 added
230 unmodified lines
231232 def __ne__(self, other):233 return not self.__eq__(other)234235 # Restore Python 2 hashing behavior on Python 3236 __hash__ = object.__hash__237238 def __repr__(self):239 return '%s(%s)' % (240 self.__class__.__name__,241 ', '.join('%s=%r' % (arg, getattr(self, arg, None)) for
673 unmodified lines
modified:jinja2/runtime.py+11 added-1 removed
495 unmodified lines
496 __getitem__ = __lt__ = __le__ = __gt__ = __ge__ = __int__ = \497 __float__ = __complex__ = __pow__ = __rpow__ = \498 _fail_with_undefined_error499500 def __eq__(self, other):501 return type(self) is type(other)502503 def __ne__(self, other):504 return not self.__eq__(other)505506 def __hash__(self):507 return id(type(self))508509 def __str__(self):510 return u''511512 def __len__(self):
58 unmodified lines
571 UndefinedError: 'foo' is undefined572 """573 __slots__ = ()574 __iter__ = __str__ = __len__ = __nonzero__ = __eq__ = \566 __ne__ = __bool__ = Undefined._fail_with_undefined_error575 __ne__ = __bool__ = __hash__ = \576 Undefined._fail_with_undefined_error577578579# remove remaining slots attributes, after the metaclass did the magic they580# are unneeded and irritating as they contain wrong data for the subclasses.
1 unmodified line
modified:CHANGES+3 added
8 unmodified lines
9 and context filters.10- Fixed lack of Python 3 support for bytecode caches.11- Reverted support for defining blocks in included templates as this12 broke existing templates for users.13- Fixed some warnings with hashing of undefineds and nodes if Python14 is run with warnings for Python 3.15- Added support for properly hashing undefined objects.1617Version 2.718-----------19(codename Translation, released on May 20th 2013)
294 unmodified lines