Skip to content

asyncio.current_task() is None for asyncio.tasks._PyTask 3.14a6 #131709

Closed as not planned
@graingert

Description

@graingert

Bug report

Bug description:

import asyncio

async def main():
    async def asyncfn():
        assert asyncio.current_task()

    t = asyncio.tasks._CTask(asyncfn())
    await t
    print("ctask worked")
    t = asyncio.tasks._PyTask(asyncfn())
    await t
    print("pytask worked")

asyncio.run(main())

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Metadata

Metadata

Labels

3.14bugs and security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions