FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-125243: Fix ZoneInfo data race in free threading build by colesbury · Pull Request #125281 · python/cpython · GitHub

/ cpython Public

gh-125243: Fix ZoneInfo data race in free threading build - #125281

Merged
colesbury merged 3 commits into
python:mainfrom
colesbury:gh-125245-zoneinfo
Oct 13, 2024
Merged

gh-125243: Fix ZoneInfo data race in free threading build#125281
colesbury merged 3 commits into
python:mainfrom
colesbury:gh-125245-zoneinfo

Conversation

colesbury commented Oct 10, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

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.

colesbury changed the title gh-125245: Fix ZoneInfo data race in free threading build gh-125243: Fix ZoneInfo data race in free threading build Oct 10, 2024
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`.
colesbury marked this pull request as ready for review October 11, 2024 00:42
Comment thread Modules/_zoneinfo.c Outdated

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM.

colesbury added the needs backport to 3.13 bugs and security fixes label Oct 13, 2024
colesbury merged commit f1d33db into python:main Oct 13, 2024

Copy link
Copy Markdown

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

colesbury deleted the gh-125245-zoneinfo branch October 13, 2024 20:17
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 13, 2024
…onGH-125281)

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 f1d33db)

Co-authored-by: Sam Gross <colesbury@gmail.com>

bedevere-app Bot commented Oct 13, 2024

Copy link
Copy Markdown

GH-125414 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Oct 13, 2024
colesbury added a commit that referenced this pull request Oct 15, 2024
…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 f1d33db)

Co-authored-by: Sam Gross <colesbury@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL