Skip to content
This repository was archived by the owner on Jun 25, 2018. It is now read-only.
This repository was archived by the owner on Jun 25, 2018. It is now read-only.

asyncio.Task.current_task() returns None #54

@diefans

Description

@diefans

If I register a signal handler within a task to cancel itself, tokio failes with:
AttributeError: 'NoneType' object has no attribute 'cancel'

async def test_tokio_failes():
    current_task = asyncio.Task.current_task()
    asyncio.get_event_loop().add_signal_handler(signal.SIGINT, current_task.cancel)

def main():
    # ...
    loop.run_until_complete(test_tokio_failes())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions