]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-139103: fix free-threading `dataclass.__init__` perf issue (gh-141596)
authorEdward Xu <xuxiangad@gmail.com>
Wed, 19 Nov 2025 00:57:59 +0000 (08:57 +0800)
committerGitHub <noreply@github.com>
Wed, 19 Nov 2025 00:57:59 +0000 (00:57 +0000)
commitce791541769a41beabec0f515cd62e504d46ff1c
treea43d66c05b299cd9906ec77bcfbb3c5a0c8f153f
parent652c764a59913327b28b32016405696a620d969e
gh-139103: fix free-threading `dataclass.__init__` perf issue (gh-141596)

The dataclasses `__init__` function is generated dynamically by a call to `exec()` and so doesn't have deferred reference counting enabled. Enable deferred reference counting on functions when assigned as an attribute to type objects to avoid reference count contention when creating dataclass instances.
Misc/NEWS.d/next/Core_and_Builtins/2025-11-15-23-58-23.gh-issue-139103.9cVYJ0.rst [new file with mode: 0644]
Objects/typeobject.c
Tools/ftscalingbench/ftscalingbench.py