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

Future._copy_state does not copy the traceback #3

@vxgmichel

Description

@vxgmichel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions