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.
| | |
| | | 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, '', '') |