Skip to content

crash in asyncio if finalizer doesn't calls superclass finalizer #129289

@kumaraditya303

Description

@kumaraditya303

Crash report

The following code crashes the interpreter by reading into freed memory.

import asyncio

class MyTask(asyncio.Task):
    def __del__(self):
        print("MyTask.__del__")


async def main():
    task = MyTask(asyncio.sleep(1))
    await task

asyncio.run(main())

Output:

✦ ❯ ./python main.py
MyTask.__del__
fish: Job 2, './python main.py' terminated by signal SIGSEGV (Address boundary error)

Supporting subclasses seems tricky with it, I propose to use fast implementation only with exact types.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-asynciotype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions