]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-125243: Fix ZoneInfo data race in free threading build (GH-125281) (gh...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 15 Oct 2024 21:02:32 +0000 (23:02 +0200)
committerGitHub <noreply@github.com>
Tue, 15 Oct 2024 21:02:32 +0000 (17:02 -0400)
commit6474e296c04f136c9d664c899d126795f280ff11
tree723d135ff6bf27c79829b5439c896dfcdcb026f7
parent2ded598323ebe44a422d36a6b8ede611b4b34dba
[3.13] gh-125243: Fix ZoneInfo data race in free threading build (GH-125281) (gh-125414)

Lock `ZoneInfoType` to protect accesses to `ZONEINFO_STRONG_CACHE`.
Refactor the `tp_new` handler to use Argument Clinic so that we can just
use `@critical_section` annotations on the relevant functions.

Also use `PyDict_SetDefaultRef` instead of `PyDict_SetDefault` when
inserting into the `TIMEDELTA_CACHE`.
(cherry picked from commit f1d33dbddd3496b062e1fbe024fb6d7b023a35f5)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Misc/NEWS.d/next/Library/2024-10-10-20-39-57.gh-issue-125243.eUbbtu.rst [new file with mode: 0644]
Modules/_zoneinfo.c
Modules/clinic/_zoneinfo.c.h