GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-125243: Fix ZoneInfo data race in free threading build by colesbury · Pull Request #125281 · python/cpython

Conversation

@colesbury

@colesbury colesbury commented Oct 10, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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.

  • Issue: ZoneInfo comparison fails on free-threaded build #125243

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot mentioned this pull request Oct 10, 2024
Race condition when importing collections.abc #125245
Closed
@colesbury colesbury mentioned this pull request Oct 10, 2024
ZoneInfo comparison fails on free-threaded build #125243
Closed
@colesbury 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
@colesbury
pythongh-125243: Fix ZoneInfo data race in free threading build
0f4f427
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
colesbury force-pushed the gh-125245-zoneinfo branch from bcaa724 to 0f4f427 Compare October 10, 2024 20:52
@colesbury
Regen clinic
282890b
@colesbury
colesbury marked this pull request as ready for review October 11, 2024 00:42
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 11, 2024
@colesbury colesbury added the topic-free-threading label Oct 11, 2024
@colesbury
colesbury requested a review from serhiy-storchaka October 11, 2024 00:42
serhiy-storchaka
serhiy-storchaka reviewed Oct 11, 2024
View reviewed changes
Comment thread Modules/_zoneinfo.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@colesbury
Use zoneinfo_ZoneInfo_impl in zoneinfo_ZoneInfo__unpickle_impl
89a8cd3
@colesbury
colesbury requested a review from serhiy-storchaka October 13, 2024 16:48
kumaraditya303
kumaraditya303 approved these changes Oct 13, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 13, 2024
serhiy-storchaka
serhiy-storchaka approved these changes Oct 13, 2024
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@colesbury colesbury added the needs backport to 3.13 only security fixes label Oct 13, 2024
@colesbury
colesbury merged commit f1d33db into python:main Oct 13, 2024
@miss-islington-app

miss-islington-app Bot commented Oct 13, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 13, 2024
@colesbury
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
@colesbury @miss-islington
pythongh-125243: Fix ZoneInfo data race in free threading build (pyth…
a9c2581
…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 <[email protected]>
@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Oct 13, 2024
colesbury added a commit that referenced this pull request Oct 15, 2024
@miss-islington @colesbury
[3.13] gh-125243: Fix ZoneInfo data race in free threading build (GH-…
6474e29
…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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@colesbury @serhiy-storchaka @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.