Skip to content
Myr

Merge pull request #216 from Lukasa/luk-sprint-branch

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

authored by Armin Ronacher · committed by Armin Ronacher · parents e94dd1f, e8acd5b · Browse files · 2 files+8 added−26 removed
This commit

State

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

Trailers

  • Sprint: Not supporting Python 2.4 is a blessing

Diff stats

2 files+8 added−26 removed

  • other:+8 added−26 removed

2 files+8 added−26 removed

modified:jinja2/bccache.py+1 added-2 removed
17 unmodified lines
18import sys19import marshal20import tempfile21from six.moves import cPickle as pickle22from six import BytesIO23import fnmatch24try:25 from hashlib import sha126except ImportError:
2 unmodified lines
293031# marshal works better on 3.x, one hack less required32if sys.version_info[0] >= 3:32 from io import BytesIO33 marshal_dump = marshal.dump34 marshal_load = marshal.load35else:36 from cStringIO import StringIO as BytesIO3637 def marshal_dump(code, f):38 if isinstance(f, file):39 marshal.dump(code, f)
261 unmodified lines
modified:jinja2/compiler.py+7 added-24 removed
34 unmodified lines
35 'in': 'in',36 'notin': 'not in'37}3839try:40 exec('(0 if 0 else 0)')41except SyntaxError:42 have_condexpr = False43else:44 have_condexpr = True454639# what method to iterate over items do we want to use for dict iteration40# in generated code? on 2.x let's go with iteritems, on 3.x with items41if hasattr(dict, 'iteritems'):42 dict_item_iter = 'iteritems'
1513 unmodified lines
1556 self.write('environment.undefined(%r)' % ('the inline if-'1557 'expression on %s evaluated to false and '1558 'no else section was defined.' % self.position(node)))15591568 if not have_condexpr:1569 self.write('((')1570 self.visit(node.test, frame)1571 self.write(') and (')1572 self.visit(node.expr1, frame)1573 self.write(',) or (')1574 write_expr2()1575 self.write(',))[0]')1576 else:1577 self.write('(')1578 self.visit(node.expr1, frame)1579 self.write(' if ')1580 self.visit(node.test, frame)1581 self.write(' else ')1582 write_expr2()1583 self.write(')')1560 self.write('(')1561 self.visit(node.expr1, frame)1562 self.write(' if ')1563 self.visit(node.test, frame)1564 self.write(' else ')1565 write_expr2()1566 self.write(')')15671568 def visit_Call(self, node, frame, forward_caller=False):1569 if self.environment.sandboxed:1570 self.write('environment.call(context, ')
72 unmodified lines