Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: third_party/jinja2/debug.py

Issue 23506004: Update Jinja2 (Python template library) to 2.7.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/jinja2/compiler.py ('k') | third_party/jinja2/defaults.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/jinja2/debug.py
diff --git a/third_party/jinja2/debug.py b/third_party/jinja2/debug.py
index 2af2222322782c628697dbe7bfef661eb084559d..815cc18a4f8fd76e747835f24c1297a7d2264628 100644
--- a/third_party/jinja2/debug.py
+++ b/third_party/jinja2/debug.py
@@ -13,8 +13,9 @@
import sys
import traceback
from types import TracebackType
-from jinja2.utils import CodeType, missing, internal_code
+from jinja2.utils import missing, internal_code
from jinja2.exceptions import TemplateSyntaxError
+from jinja2._compat import iteritems, reraise, code_type
# on pypy we can take advantage of transparent proxies
try:
@@ -25,7 +26,7 @@ except ImportError:
# how does the raise helper look like?
try:
- exec "raise TypeError, 'foo'"
+ exec("raise TypeError, 'foo'")
except SyntaxError:
raise_helper = 'raise __jinja_exception__[1]'
except TypeError:
@@ -77,7 +78,7 @@ def make_frame_proxy(frame):
class ProcessedTraceback(object):
- """Holds a Jinja preprocessed traceback for priting or reraising."""
+ """Holds a Jinja preprocessed traceback for printing or reraising."""
def __init__(self, exc_type, exc_value, frames):
assert frames, 'no frames for this traceback?'
@@ -158,7 +159,7 @@ def translate_exception(exc_info, initial_skip=0):
frames = []
# skip some internal frames if wanted
- for x in xrange(initial_skip):
+ for x in range(initial_skip):
if tb is not None:
tb = tb.tb_next
initial_tb = tb
@@ -189,7 +190,7 @@ def translate_exception(exc_info, initial_skip=0):
# reraise it unchanged.
# XXX: can we backup here? when could this happen?
if not frames:
- raise exc_info[0], exc_info[1], exc_info[2]
+ reraise(exc_info[0], exc_info[1], exc_info[2])
return ProcessedTraceback(exc_info[0], exc_info[1], frames)
@@ -206,7 +207,7 @@ def fake_exc_info(exc_info, filename, lineno):
locals = ctx.get_all()
else:
locals = {}
- for name, value in real_locals.iteritems():
+ for name, value in iteritems(real_locals):
if name.startswith('l_') and value is not missing:
locals[name[2:]] = value
@@ -244,17 +245,17 @@ def fake_exc_info(exc_info, filename, lineno):
location = 'block "%s"' % function[6:]
else:
location = 'template'
- code = CodeType(0, code.co_nlocals, code.co_stacksize,
- code.co_flags, code.co_code, code.co_consts,
- code.co_names, code.co_varnames, filename,
- location, code.co_firstlineno,
- code.co_lnotab, (), ())
+ code = code_type(0, code.co_nlocals, code.co_stacksize,
+ code.co_flags, code.co_code, code.co_consts,
+ code.co_names, code.co_varnames, filename,
+ location, code.co_firstlineno,
+ code.co_lnotab, (), ())
except:
pass
# execute the code and catch the new traceback
try:
- exec code in globals, locals
+ exec(code, globals, locals)
except:
exc_info = sys.exc_info()
new_tb = exc_info[2].tb_next
@@ -330,10 +331,7 @@ def _init_ugly_crap():
tb_set_next = None
if tproxy is None:
try:
- from jinja2._debugsupport import tb_set_next
- except ImportError:
- try:
- tb_set_next = _init_ugly_crap()
- except:
- pass
+ tb_set_next = _init_ugly_crap()
+ except:
+ pass
del _init_ugly_crap
« no previous file with comments | « third_party/jinja2/compiler.py ('k') | third_party/jinja2/defaults.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698