utils: remove some old py compat code
diff --git a/jinja2/utils.py b/jinja2/utils.py
index ca0968b..b56c749 100644
--- a/jinja2/utils.py
+++ b/jinja2/utils.py
@@ -45,29 +45,7 @@
# internal code
internal_code = set()
-
-# concatenate a list of strings and convert them to unicode.
-# unfortunately there is a bug in python 2.4 and lower that causes
-# unicode.join trash the traceback.
-_concat = u''.join
-try:
- def _test_gen_bug():
- raise TypeError(_test_gen_bug)
- yield None
- _concat(_test_gen_bug())
-except TypeError as _error:
- if not _error.args or _error.args[0] is not _test_gen_bug:
- def concat(gen):
- try:
- return _concat(list(gen))
- except Exception:
- # this hack is needed so that the current frame
- # does not show up in the traceback.
- exc_type, exc_value, tb = sys.exc_info()
- six.reraise(exc_type, exc_value, tb.tb_next)
- else:
- concat = _concat
- del _test_gen_bug, _error
+concat = u''.join
# if this python version is unable to deal with unicode filenames
@@ -380,18 +358,10 @@
# alias all queue methods for faster lookup
self._popleft = self._queue.popleft
self._pop = self._queue.pop
- if hasattr(self._queue, 'remove'):
- self._remove = self._queue.remove
+ self._remove = self._queue.remove
self._wlock = allocate_lock()
self._append = self._queue.append
- def _remove(self, obj):
- """Python 2.4 compatibility."""
- for idx, item in enumerate(self._queue):
- if item == obj:
- del self._queue[idx]
- break
-
def __getstate__(self):
return {
'capacity': self.capacity,
@@ -605,15 +575,4 @@
from jinja2._markupsafe import Markup, escape, soft_unicode
-# partials
-try:
- from functools import partial
-except ImportError:
- class partial(object):
- def __init__(self, _func, *args, **kwargs):
- self._func = _func
- self._args = args
- self._kwargs = kwargs
- def __call__(self, *args, **kwargs):
- kwargs.update(self._kwargs)
- return self._func(*(self._args + args), **kwargs)
+from functools import partial