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 — [3.13] gh-125243: Fix ZoneInfo data race in free threading build (GH-125281) by miss-islington · Pull Request #125414 · python/cpython

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 13, 2024 •
edited by bedevere-app Bot
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.
(cherry picked from commit f1d33db)

Co-authored-by: Sam Gross [email protected]

  • 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
@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 added the awaiting review label Oct 13, 2024
This was referenced Oct 13, 2024
ZoneInfo comparison fails on free-threaded build #125243
Closed
gh-125243: Fix ZoneInfo data race in free threading build #125281
Merged
@bedevere-app bedevere-app Bot added the topic-free-threading label Oct 13, 2024
rruuaanng
rruuaanng approved these changes Oct 14, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Oct 14, 2024
rruuaanng
rruuaanng reviewed Oct 14, 2024
View reviewed changes
Comment thread Modules/clinic/_zoneinfo.c.h
zoneinfo_ZoneInfo(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)

@rruuaanng rruuaanng Oct 14, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

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.

suggestion: Preprocessing maybe placed in the first column. This allows you to keep your style consistent with the other extension modules.
for example:

cpython/Modules/syslogmodule.c

Lines 234 to 244 in f1d33db

#ifdef __APPLE__
// gh-98178: On macOS, libc syslog() is not thread-safe
syslog(priority, "%s", message);
#else
Py_BEGIN_ALLOW_THREADS;
syslog(priority, "%s", message);
Py_END_ALLOW_THREADS;
#endif
Py_XDECREF(ident);
Py_RETURN_NONE;
}

zoneinfo_ZoneInfo(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
    PyObject *return_value = NULL;
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)

Sorry, something went wrong.

Uh oh!

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

All reactions

@colesbury colesbury Oct 15, 2024

Copy link
Copy Markdown
Contributor

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.

This is a generated file

Sorry, something went wrong.

Uh oh!

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

All reactions
@colesbury
colesbury merged commit 6474e29 into python:3.13 Oct 15, 2024
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 15, 2024
@miss-islington
miss-islington deleted the backport-f1d33db-3.13 branch January 2, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@colesbury colesbury colesbury left review comments
+1 more reviewer
@rruuaanng rruuaanng rruuaanng approved these changes
Reviewers whose approvals may not affect merge requirements

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

@miss-islington @colesbury @rruuaanng
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.