[3.14] gh-139103: fix free-threading `dataclass.__init__` perf issue (gh-141596) (gh-141750)
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. (cherry picked from commit ce791541769a41beabec0f515cd62e504d46ff1c) Co-authored-by: Edward Xu <xuxiangad@gmail.com>
S
Sam Gross committed
b7c25eabd6d93e745c7216b42d026e6a36795724
Parent: 8c79688
Committed by GitHub <noreply@github.com>
on 11/19/2025, 3:00:51 PM