Skip to content
Myr

Fix TracebackFrameProxy.set_next() on Python 3.7

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

Fix issue #1050: fix a crash in TracebackFrameProxy.set_next() on Python 3.7 and newer, when Python is build in debug mode. Since Python 3.7, traceback.tb_next field can be modified: ctypes is no longer needed.

authored by Victor Stinner · committed by David Lord · parent d601b3f · Browse files · 2 files+13 added−5 removed
This commit

State

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

Diff stats

2 files+13 added−5 removed

  • other:+13 added−5 removed

2 files+13 added−5 removed

modified:jinja2/debug.py+11 added-5 removed
363 unmodified lines
364# try to get a tb_set_next implementation if we don't have transparent365# proxies.366tb_set_next = None367if tproxy is None:368 # traceback.tb_next can be modified since CPython 3.7369 if sys.version_info >= (3, 7):370 def tb_set_next(tb, next):371 tb.tb_next = next372 else:373 # On Python 3.6 and older, use ctypes368 try:369 tb_set_next = _init_ugly_crap()370 except:371 pass372 del _init_ugly_crap374 try:375 tb_set_next = _init_ugly_crap()376 except Exception:377 pass378del _init_ugly_crap
modified:CHANGES.rst+2 added
6 unmodified lines
78- Fix Python 3.7 deprecation warnings.9- Using ``range`` in the sandboxed environment uses ``xrange`` on10 Python 2 to avoid memory use. :issue:`933`11- Use Python 3.7's better traceback support to avoid a core dump when12 using debug builds of Python 3.7. :issue:`1050`131415Version 2.10.116--------------
608 unmodified lines