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-120837: Update _Py_DumpExtensionModules to be async-signal-safe by corona10 · Pull Request #121051 · python/cpython

Conversation

@corona10

@corona10 corona10 commented Jun 26, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: faulthandler itself crashes in free-threading build (in _Py_DumpExtensionModules) #120837

Sorry, something went wrong.

Uh oh!

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

All reactions
@corona10
pythongh-120837: Update _Py_DumpExtensionModules to be async-signal-safe
8430508
@corona10
corona10 requested review from colesbury and vstinner June 26, 2024 15:10
@corona10
corona10 requested a review from ericsnowcurrently as a code owner June 26, 2024 15:10
@bedevere-app bedevere-app Bot mentioned this pull request Jun 26, 2024
faulthandler itself crashes in free-threading build (in _Py_DumpExtensionModules) #120837
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jun 26, 2024
@corona10 corona10 added skip news needs backport to 3.13 only security fixes labels Jun 26, 2024
corona10
corona10 commented Jun 26, 2024
View reviewed changes
Comment thread Python/pylifecycle.c Outdated
PyMutex *mutex = &obj->ob_mutex;
uint8_t expected = _Py_UNLOCKED;
// Do not wake up other threads.
_Py_atomic_compare_exchange_uint8(&mutex->_bits, &expected, _Py_UNLOCKED);

@corona10 corona10 Jun 26, 2024

Copy link
Copy Markdown
Member Author

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.

Do we have to run for loop to prevent CAS failure?

Sorry, something went wrong.

Uh oh!

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

All reactions

@colesbury colesbury Jun 26, 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.

I think this should be a _Py_atomic_store_uint8(&mutex->_bits, _Py_UNLOCKED)

Sorry, something went wrong.

Uh oh!

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

corona10 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@corona10
nit
07962e5
@corona10 corona10 added the topic-free-threading label Jun 26, 2024
@corona10
fix
1f56fcc
vstinner
vstinner reviewed Jun 26, 2024
View reviewed changes
Comment thread Python/pylifecycle.c Resolved

Uh oh!

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

@corona10
Address code review
e7f24af
@corona10
corona10 requested a review from vstinner June 27, 2024 11:10
vstinner
vstinner reviewed Jun 27, 2024
View reviewed changes
Comment thread Python/pylifecycle.c Resolved

Uh oh!

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

@corona10
Address code review
ed9bb3b
@corona10
corona10 requested a review from vstinner June 27, 2024 11:33
@corona10
nit
136e8d1
@corona10

corona10 commented Jun 27, 2024

Copy link
Copy Markdown
Member Author

@colesbury PTAL :)

All reactions

Sorry, something went wrong.

Uh oh!

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

colesbury
colesbury reviewed Jun 27, 2024
View reviewed changes
Comment thread Python/pylifecycle.c Resolved

Uh oh!

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

Comment thread Python/pylifecycle.c Resolved

Uh oh!

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

Comment thread Python/pylifecycle.c Outdated
PyMutex *mutex = &obj->ob_mutex;
uint8_t expected = _Py_UNLOCKED;
// Do not wake up other threads.
_Py_atomic_compare_exchange_uint8(&mutex->_bits, &expected, _Py_UNLOCKED);

@colesbury colesbury Jun 26, 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.

I think this should be a _Py_atomic_store_uint8(&mutex->_bits, _Py_UNLOCKED)

Sorry, something went wrong.

Uh oh!

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

corona10 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread Python/pylifecycle.c Resolved

Uh oh!

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

@corona10
Address code review
61de424
@corona10
corona10 requested a review from colesbury June 27, 2024 20:53
colesbury
colesbury approved these changes Jun 27, 2024
View reviewed changes

@colesbury colesbury 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.

LGTM, thanks for fixing this!

(I left one minor comment inline. Up to you what you want to do with it.)

Sorry, something went wrong.

Uh oh!

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

corona10 reacted with rocket emoji
All reactions
  • 🚀 1 reaction
Comment thread Python/pylifecycle.c Outdated
Comment on lines +2922 to +2923
#else
return;

@colesbury colesbury Jun 27, 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.

The #else return; doesn't do anything. I would delete it, but up to you.

Sorry, something went wrong.

Uh oh!

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

All reactions

@corona10 corona10 Jun 27, 2024

Copy link
Copy Markdown
Member Author

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.

Done!

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 Jun 27, 2024
@corona10
Address code review
2d31780
@corona10
corona10 merged commit 1a2e7a7 into python:main Jun 27, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 27, 2024
@miss-islington-app

miss-islington-app Bot commented Jun 27, 2024

Copy link
Copy Markdown

Thanks @corona10 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.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 27, 2024
@corona10 @miss-islington
pythongh-120837: Update _Py_DumpExtensionModules to be async-signal-s…
eca340e
…afe (pythongh-121051)

(cherry picked from commit 1a2e7a7)

Co-authored-by: Donghee Na <[email protected]>
@bedevere-app

bedevere-app Bot commented Jun 27, 2024

Copy link
Copy Markdown

GH-121107 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 Jun 27, 2024
@corona10
corona10 deleted the gh-120837 branch June 27, 2024 21:47
corona10 added a commit that referenced this pull request Jun 27, 2024
@miss-islington @corona10
[3.13] gh-120837: Update _Py_DumpExtensionModules to be async-signal-…
d5441f6
…safe (gh-121051) (gh-121107)

gh-120837: Update _Py_DumpExtensionModules to be async-signal-safe (gh-121051)
(cherry picked from commit 1a2e7a7)

Co-authored-by: Donghee Na <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
@corona10 @mrahtz
pythongh-120837: Update _Py_DumpExtensionModules to be async-signal-s…
91a1a8b
…afe (pythongh-121051)
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@corona10 @estyxx
pythongh-120837: Update _Py_DumpExtensionModules to be async-signal-s…
4c103de
…afe (pythongh-121051)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@colesbury colesbury colesbury approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@vstinner vstinner Awaiting requested review from vstinner

Uh oh!

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

Assignees

No one assigned

Labels

skip news 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

@corona10 @vstinner @colesbury
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.