diff options
| author | Bert JW Regeer <bertjw@regeer.org> | 2015-10-11 22:45:26 -0600 |
|---|---|---|
| committer | Bert JW Regeer <bertjw@regeer.org> | 2015-10-11 23:43:09 -0600 |
| commit | ce042deddabc824caefdcaaf97f3ab9654777a96 (patch) | |
| tree | df6ff2163d56dfb276563b62fe2b3100ca709586 | |
| parent | cc9126ed2b215fe6c59ca9eb74e6e0a55b9fc76e (diff) | |
| download | pyramid-ce042deddabc824caefdcaaf97f3ab9654777a96.tar.gz pyramid-ce042deddabc824caefdcaaf97f3ab9654777a96.tar.bz2 pyramid-ce042deddabc824caefdcaaf97f3ab9654777a96.zip | |
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.
| -rw-r--r-- | pyramid/util.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pyramid/util.py b/pyramid/util.py index 1ae7e6afc..12eae3626 100644 --- a/pyramid/util.py +++ b/pyramid/util.py @@ -554,7 +554,14 @@ def action_method(wrapped): 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, '', '') |
