Skip to content

gh-109693: Update _gil_runtime_state.locked to use pyatomic.h #110836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Oct 16, 2023

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Oct 13, 2023

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

@colesbury: Do you want to review pyatomic.h changes?

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Windows logs many compiler warnings, see: https://github.com/python/cpython/pull/110836/files

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

Can you also add a test to Modules/_testcapi/pyatomic.c for the new functions?

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

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

Two more comments I missed in the first pass. When you get everything working to your satisfaction, I'd suggest testing the PR on all the buildbots as there is some platforms specific code.

@corona10
Copy link
Member Author

Two more comments I missed in the first pass. When you get everything working to your satisfaction, I'd suggest testing the PR on all the buildbots as there is some platforms specific code.

Got it

@corona10 corona10 changed the title gh-109693: Update _gil_runtime_state.locked to use pyatomic.h [WIP] gh-109693: Update _gil_runtime_state.locked to use pyatomic.h Oct 13, 2023
@corona10 corona10 changed the title [WIP] gh-109693: Update _gil_runtime_state.locked to use pyatomic.h gh-109693: Update _gil_runtime_state.locked to use pyatomic.h Oct 13, 2023
@corona10 corona10 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 13, 2023
@corona10
Copy link
Member Author

corona10 commented Oct 13, 2023

Convert to the draft PR since I need to check many things.

@corona10 corona10 marked this pull request as draft October 13, 2023 17:15
@corona10 corona10 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 13, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @corona10 for commit b5d0539 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 13, 2023
@vstinner
Copy link
Member

You can use !buildbot PATTERN to only run tests on a specific CI rather pulling the huge number of CI, it may be faster as well. Tell me of you need help about that.

@corona10 corona10 marked this pull request as ready for review October 15, 2023 11:17
@corona10 corona10 changed the title [WIP] gh-109693: Update _gil_runtime_state.locked to use pyatomic.h gh-109693: Update _gil_runtime_state.locked to use pyatomic.h Oct 15, 2023
@corona10
Copy link
Member Author

corona10 commented Oct 15, 2023

@colesbury @vstinner
Okay, the failed test(test_exception) on build bots are not directly related to this PR. (I monitored another build, and it happens)

So can you please take a look?

_Py_atomic_store_int_release(int *obj, int value)
{
#if defined(_M_X64) || defined(_M_IX86)
*(int volatile *)obj = value;
Copy link
Member Author

@corona10 corona10 Oct 15, 2023

Choose a reason for hiding this comment

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

@colesbury
Basically, int volatile * and volatile int* have the same meaning.
So I just follow the convention from _Py_atomic_load_ptr_acquire

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@corona10
Copy link
Member Author

Thanks @vstinner , let's wait @colesbury too :)

@corona10 corona10 merged commit 86559dd into python:main Oct 16, 2023
@corona10 corona10 deleted the gh-109693-gil-api branch October 16, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants