Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: Reference leak in_asyncio_Task___init___impl in_asynciomodule.c #126083

Closed
Assignees
Nico-Posada
Labels
3.12only security fixes3.13bugs and security fixes3.14bugs and security fixeseasyextension-modulesC modules in the Modules dirtopic-asynciotype-bugAn unexpected behavior, bug, or error
@Nico-Posada

Description

@Nico-Posada

Bug report

Bug description:

I discovered this while working on#126080. If the func is given a context that isn'tNone, instead of doingPy_XSETREF it'll just do a regular assignment meaning that whatever was there before wont have its reference count decreased.

}else {
self->task_context=Py_NewRef(context);
}

importasyncioimportsys# for convenience so I dont have to set up everything else for a Task obj# and can just focus on the ref leakclassBreak:def__str__(self):raiseException("break")asyncdefcoro():passtask=asyncio.Task.__new__(asyncio.Task)co=coro()obj=object()print("refcount before bug",sys.getrefcount(obj))for_inrange(10000):try:task.__init__(co,context=obj,name=Break())except:passprint("refcount after bug",sys.getrefcount(obj))

Output

refcount before bug 2refcount after bug 10002

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

3.12only security fixes3.13bugs and security fixes3.14bugs and security fixeseasyextension-modulesC modules in the Modules dirtopic-asynciotype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp