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

Unified Diff: third_party/jinja2/debug.py

Issue 2316103002: binding: Updates Jinja2 from 2.7.1 to 2.8. (Closed)
Patch Set: Created 4 years, 3 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 815cc18a4f8fd76e747835f24c1297a7d2264628..3252748369484f75025fd90ae4f3dcb4e1232900 100644
--- a/third_party/jinja2/debug.py
+++ b/third_party/jinja2/debug.py
@@ -12,10 +12,10 @@
"""
import sys
import traceback
-from types import TracebackType
+from types import TracebackType, CodeType
from jinja2.utils import missing, internal_code
from jinja2.exceptions import TemplateSyntaxError
-from jinja2._compat import iteritems, reraise, code_type
+from jinja2._compat import iteritems, reraise, PY2
# on pypy we can take advantage of transparent proxies
try:
@@ -245,12 +245,21 @@ def fake_exc_info(exc_info, filename, lineno):
location = 'block "%s"' % function[6:]
else:
location = 'template'
- 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:
+
+ if PY2:
+ 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, (), ())
+ else:
+ code = CodeType(0, code.co_kwonlyargcount,
+ 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 Exception as e:
pass
# execute the code and catch the new traceback
@@ -273,11 +282,15 @@ def _init_ugly_crap():
import ctypes
from types import TracebackType
- # figure out side of _Py_ssize_t
- if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
- _Py_ssize_t = ctypes.c_int64
+ if PY2:
+ # figure out size of _Py_ssize_t for Python 2:
+ if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
+ _Py_ssize_t = ctypes.c_int64
+ else:
+ _Py_ssize_t = ctypes.c_int
else:
- _Py_ssize_t = ctypes.c_int
+ # platform ssize_t on Python 3
+ _Py_ssize_t = ctypes.c_ssize_t
# regular python
class _PyObject(ctypes.Structure):
« 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