Bert JW Regeer
2015-10-12 0fef6de59e26efcdcef2bd9e0ba65df904cd5166
Fix Python 3.5 support

Python 3.5 inserts an extra stackframe when calling extract_traceback,
this adds in a check to see if the last frame is this extra frame, and
if so removes it. This doesn't affect any other version of Python.
1 files modified
9 ■■■■ changed files
pyramid/util.py 9 ●●●● patch | view | raw | blame | history
pyramid/util.py
@@ -519,7 +519,14 @@
            info = ActionInfo(*info)
        if info is None:
            try:
                f = traceback.extract_stack(limit=3)
                f = traceback.extract_stack(limit=4)
                # Work around a Python 3.5 issue whereby it would insert an
                # extra stack frame. This should no longer be necessary in
                # Python 3.5.1
                last_frame = ActionInfo(*f[-1])
                if last_frame.function == 'extract_stack':
                    f.pop()
                info = ActionInfo(*f[-backframes])
            except: # pragma: no cover
                info = ActionInfo(None, 0, '', '')