Merge branch 'pr/451'
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 0c1f192, f4ddad8 · Browse files · 1 file·+24 added−11 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+24 added−11 removed
- other:+24 added−11 removed
Provenance
- Commit
0bfb60f- Tree
55740f9- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent 1
0c1f192- Parent 2
f4ddad8
1 file changed+24 added−11 removed
modified:jinja2/debug.py+24 added-11 removed
13 unmodified lines14 import traceback15 from types import TracebackType, CodeType16 from jinja2.utils import missing, internal_code17 from jinja2.exceptions import TemplateSyntaxError18-from jinja2._compat import iteritems, reraise18+from jinja2._compat import iteritems, reraise, PY219 20 # on pypy we can take advantage of transparent proxies21 try:22 from __pypy__ import tproxy221 unmodified lines244 elif function.startswith('block_'):245 location = 'block "%s"' % function[6:]246 else:247 location = 'template'248+249+ if PY2:248- code = CodeType(0, code.co_nlocals, code.co_stacksize,249- code.co_flags, code.co_code, code.co_consts,250- code.co_names, code.co_varnames, filename,251- location, code.co_firstlineno,252- code.co_lnotab, (), ())253- except:250+ code = CodeType(0, code.co_nlocals, code.co_stacksize,251+ code.co_flags, code.co_code, code.co_consts,252+ code.co_names, code.co_varnames, filename,253+ location, code.co_firstlineno,254+ code.co_lnotab, (), ())255+ else:256+ code = CodeType(0, code.co_kwonlyargcount,257+ code.co_nlocals, code.co_stacksize,258+ code.co_flags, code.co_code, code.co_consts,259+ code.co_names, code.co_varnames, filename,260+ location, code.co_firstlineno,261+ code.co_lnotab, (), ())262+ except Exception as e:263 pass264 265 # execute the code and catch the new traceback266 try:14 unmodified lines281 """282 import ctypes283 from types import TracebackType284 285+ if PY2:276- # figure out size of _Py_ssize_t277- if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):278- _Py_ssize_t = ctypes.c_int64286+ # figure out size of _Py_ssize_t for Python 2:287+ if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):288+ _Py_ssize_t = ctypes.c_int64289+ else:290+ _Py_ssize_t = ctypes.c_int291 else:292+ # platform ssize_t on Python 3280- _Py_ssize_t = ctypes.c_int293+ _Py_ssize_t = ctypes.c_ssize_t294 295 # regular python296 class _PyObject(ctypes.Structure):297 pass53 unmodified lines