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-144446: Fix thread-safety of FrameLocalsProxy on executing frames by kumaraditya303 · Pull Request #156973 · python/cpython

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Sep 5, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Synchronize FrameLocalsProxy accesses with the frame's owning thread: fast locals are accessed under the frame object's critical section, and with the world stopped when the frame may be executing on another thread.

Changes:

  • Only the fast locals read and write run in the synchronized region. Key lookup (__hash__ / __eq__) runs outside it, so no Python code is executed while the world is stopped.
  • The extra locals dict is never touched by the running frame, so it does not need stop-the-world. It is fetched under the frame's critical section and used with the dict's own locking.
  • The value replaced in a cell is decref'd after the region, since its destructor can run arbitrary code.
  • keys(), values(), items() and len() snapshot the fast locals in the region and hold the extra locals dict's critical section while iterating it.
  • PyFrame_GetVar is synchronized the same way.

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

  • Issue: Data races with frame objects #144446

Sorry, something went wrong.

Uh oh!

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

All reactions
@kumaraditya303 @colesbury
pythongh-144446: Fix thread-safety of FrameLocalsProxy on executing f…
44c1536
…rames

Synchronize FrameLocalsProxy accesses with the frame's owning thread:
accessors run under the frame object's critical section and stop the
world when the frame is executing on another thread.

Co-authored-by: Sam Gross <[email protected]>
@bedevere-app bedevere-app Bot mentioned this pull request Sep 5, 2026
Data races with frame objects #144446
Open
2 of 3 tasks
@kumaraditya303
kumaraditya303 marked this pull request as ready for review September 9, 2026 16:14
@kumaraditya303
kumaraditya303 requested a review from markshannon as a code owner September 9, 2026 16:14
@bedevere-app bedevere-app Bot added the awaiting core review label Sep 9, 2026
@kumaraditya303
kumaraditya303 requested a review from mpage September 9, 2026 16:15
@kumaraditya303 kumaraditya303 added the topic-free-threading label Sep 9, 2026
@kumaraditya303
better comments
d33c175
mpage
mpage reviewed Sep 9, 2026
View reviewed changes
Comment thread Objects/frameobject.c Resolved

Uh oh!

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

mpage
mpage approved these changes Oct 7, 2026
View reviewed changes

@mpage mpage left a comment

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.

Putting this back on your queue

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 7, 2026
@ambv ambv mentioned this pull request Oct 20, 2026
gh-144446: Fix thread-safety of FrameLocalsProxy on executing frames #145183
Closed
ambv
ambv requested changes Oct 21, 2026
View reviewed changes

@ambv ambv left a comment

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.

I think Matt meant to request changes.

Sorry, something went wrong.

Uh oh!

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

mpage reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting merge labels Oct 21, 2026
@bedevere-app

bedevere-app Bot commented Oct 21, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

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

kumaraditya303 added 4 commits November 9, 2026 16:14
@kumaraditya303
address review and minimize diff
41630d2
@kumaraditya303
remove some tests
5faa4b5
@kumaraditya303
remove config.c
a4cae67
@kumaraditya303
Merge branch 'main' of https://github.com/python/cpython into pythong…
e94a203
…h-144446-frame-locals
@kumaraditya303 kumaraditya303 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 9, 2026
@bedevere-bot

bedevere-bot commented Nov 9, 2026

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit e94a203 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F156973%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 9, 2026
@kumaraditya303

kumaraditya303 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot added awaiting change review and removed awaiting changes labels Nov 9, 2026
@bedevere-app

bedevere-app Bot commented Nov 9, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@ambv, @mpage: please review the changes made to this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app
bedevere-app Bot requested review from ambv and mpage November 9, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@ambv ambv Awaiting requested review from ambv
@mpage mpage Awaiting requested review from mpage

Uh oh!

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

Assignees

No one assigned

Labels

awaiting change review 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.

4 participants

@kumaraditya303 @bedevere-bot @ambv @mpage
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 01402520 — 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.