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.12] gh-114763: Protect lazy loading modules from attribute access races (GH-114781) by miss-islington · Pull Request #115870 · python/cpython

Conversation

@miss-islington

@miss-islington miss-islington commented Feb 24, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Setting the class attribute of a lazy-loading module to ModuleType enables other threads to attempt to access attributes before the loading is complete. Now that is protected by a lock.
(cherry picked from commit 200271c)

Co-authored-by: Chris Markiewicz [email protected]

  • Issue: Accessing attributes of a lazily-loaded module is not thread-safe #114763

Sorry, something went wrong.

Uh oh!

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

All reactions
@effigies @miss-islington
pythongh-114763: Protect lazy loading modules from attribute access r…
21221d5
…aces (pythonGH-114781)

Setting the __class__ attribute of a lazy-loading module to ModuleType enables other threads to attempt to access attributes before the loading is complete. Now that is protected by a lock.
(cherry picked from commit 200271c)

Co-authored-by: Chris Markiewicz <[email protected]>
@miss-islington
miss-islington requested review from brettcannon, encukou, ericsnowcurrently, ncoghlan and warsaw as code owners February 24, 2024 00:02
@bedevere-app bedevere-app Bot added awaiting review type-bug An unexpected behavior, bug, or error labels Feb 24, 2024
This was referenced Feb 24, 2024
gh-114763: Protect lazy loading modules from attribute access race #114781
Merged
Accessing attributes of a lazily-loaded module is not thread-safe #114763
Closed
brettcannon
brettcannon approved these changes Feb 24, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Feb 24, 2024
@brettcannon
brettcannon enabled auto-merge (squash) February 24, 2024 00:03
@brettcannon brettcannon self-assigned this Feb 24, 2024
@brettcannon
Merge branch '3.12' into backport-200271c-3.12
2647150
@brettcannon
brettcannon merged commit 7b91b90 into python:3.12 Feb 26, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 26, 2024
@effigies effigies mentioned this pull request Feb 26, 2024
Broken thread safety scientific-python/lazy-loader#88
Closed
@miss-islington
miss-islington deleted the backport-200271c-3.12 branch January 2, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brettcannon brettcannon brettcannon approved these changes
@encukou encukou Awaiting requested review from encukou encukou is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner

Uh oh!

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

Assignees

@brettcannon brettcannon

Labels

type-bug An unexpected behavior, bug, or error

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 @brettcannon @effigies
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.