Skip to content
Myr

Don't assign the range type each time.

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

authored by Cory Benfield · committed by Cory Benfield · parent b36039f · Browse files · 1 file+6 added−4 removed
This commit

State

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

Diff stats

1 file+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:jinja2/compiler.py+6 added-4 removed
17 unmodified lines
18import six19from six.moves import cStringIO as StringIO20from six.moves import map, zip2122# TODO: Move this to the compat module.23try:24 range_type = xrange25except NameError:26 range_type = range272829operators = {30 'eq': '==',31 'ne': '!=',32 'gt': '>',
43 unmodified lines
76def has_safe_repr(value):77 """Does the node have a safe representation?"""78 if value is None or value is NotImplemented or value is Ellipsis:79 return True74 try:75 range_type = xrange76 except NameError:77 range_type = range80 if isinstance(value, (bool, int, float, complex, range_type, Markup) + six.string_types):81 return True82 if isinstance(value, (tuple, list, set, frozenset)):83 for item in value:
1573 unmodified lines