Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Future._copy_state does not copy the traceback #3

Open
vxgmichel opened this issue Sep 21, 2015 · 1 comment
Open

Future._copy_state does not copy the traceback #3

vxgmichel opened this issue Sep 21, 2015 · 1 comment

Comments

@vxgmichel
Copy link

Future._copy_state does not copy the traceback and causes the following test to fail in python 2, while passing in python 3:

import pytest
try:
    import asyncio
except ImportError:
    import trollius as asyncio

def add(a, b):
    raise RuntimeError("Fail!")  # I should be in the traceback
    return a + b

def test():
    loop = asyncio.get_event_loop()
    coro = loop.run_in_executor(None, add, 1, 2)
    with pytest.raises(RuntimeError) as excinfo:
        loop.run_until_complete(coro)
    statement = str(excinfo.traceback[-1].statement)
    assert "I should be in the traceback" in statement

I guess copying the traceback in _copy_state is a bit annoying since concurrent.futures uses Future.exception_info/set_exception_info and asyncio uses Future.exception/_get_exception_tb/_set_exception_with_tb.

@jamadden
Copy link
Owner

Thank you for the report. Unfortunately this project is not maintained and not expecting to make any functional changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants